Skip to content

fix(packaging): add missing embodiedscan/__init__.py so pip install -e works#117

Open
Monalissaa wants to merge 1 commit intoInternRobotics:mainfrom
Monalissaa:fix/missing-package-init
Open

fix(packaging): add missing embodiedscan/__init__.py so pip install -e works#117
Monalissaa wants to merge 1 commit intoInternRobotics:mainfrom
Monalissaa:fix/missing-package-init

Conversation

@Monalissaa
Copy link
Copy Markdown

Summary

A fresh pip install -e . succeeds but import embodiedscan raises ModuleNotFoundError on modern setuptools (PEP 660 editable installs). Root cause: setup.py uses find_packages(exclude=...), which requires every package directory to contain an __init__.py. The top-level embodiedscan/ directory has none, so find_packages returns an empty list for it, and the editable install registers no top-level package.

This PR adds an empty embodiedscan/__init__.py — the minimal fix. An alternative would be switching to find_namespace_packages() in setup.py, but that has broader implications; adding the marker file is the safer change.

Reproducer

git clone https://github.com/OpenRobotLab/EmbodiedScan.git
python -m venv /tmp/venv && source /tmp/venv/bin/activate
pip install -e EmbodiedScan
python -c "import embodiedscan"
# → ModuleNotFoundError: No module named 'embodiedscan'

After this PR, the same flow imports cleanly. Tested with setuptools 80.x + pip 24.0 on Python 3.10.

Why this surfaces now

PEP 660 editable installs (pip>=21.3 with modern setuptools) generate a metadata-driven finder built from find_packages output. Older easy-install.pth-based editable installs masked this by simply prepending the project root to sys.path, so import embodiedscan worked even without registration. Anyone setting up a fresh environment today hits the failure.

Notes

  • Subpackages (embodiedscan.visualization, embodiedscan.models, etc.) all have their own __init__.py already and are registered correctly — they just become unreachable when the parent isn't.
  • No code change, just an empty file. Doesn't affect runtime behavior or imports beyond fixing the install.

Without this file, `setup.py`'s `find_packages(exclude=...)` returns
an empty list for the top-level `embodiedscan` directory (because it
has no `__init__.py`), so a fresh `pip install -e .` registers no
top-level package and `import embodiedscan` raises ModuleNotFoundError
on modern setuptools (PEP 660 editable installs). Subpackages like
`embodiedscan.visualization` etc. do have `__init__.py` and would be
registered, but they only become reachable through the top-level
namespace once the parent package is registered.

Adding an empty `embodiedscan/__init__.py` is the minimal fix; an
alternative would be to switch to `find_namespace_packages()` in
setup.py.

Reproducer:

    git clone https://github.com/OpenRobotLab/EmbodiedScan
    python -m venv /tmp/venv && source /tmp/venv/bin/activate
    pip install -e EmbodiedScan
    python -c "import embodiedscan"
    # → ModuleNotFoundError: No module named 'embodiedscan'

After this fix, the same flow imports cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Monalissaa added a commit to Monalissaa/OpenSpatial that referenced this pull request May 8, 2026
Add a `touch embodiedscan/__init__.py` step before `pip install -e` so
fresh-env users don't hit `ModuleNotFoundError: embodiedscan` from the
upstream packaging bug. Tracked upstream as InternRobotics/EmbodiedScan#117;
this README line can be dropped once that's merged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant