-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Running the CLI can fail because some configs contain an absolute, author-specific project path (e.g. /home/suraj/...). The import helper is passed that path and attempts to find __init__.py there, causing a FileNotFoundError on other machines.
Environment:
- Repo: DINOv2-3D-Med
- OS: Windows
- Command used:
python -m scripts.run fit --config_file=./configs/train.yaml,./configs/models/primus.yaml,./configs/datasets/amos.yaml
Reproduction steps:
- From the repository run the command above.
- Observe traceback ending with:
FileNotFoundError: No__init__.pyinU:\home\suraj\Repositories\DINOv2_3D\__init__.py
Actual behavior:
- import_module_from_path is passed an absolute path pointing to the original author’s home directory; that path does not exist and the import fails.
Expected behavior:
projectshould resolve to the local repository root (or a user-specified path on the current machine), not an author-specific absolute path.- If
projectis relative (e.g. "."), resolve it relative to the repo root or CWD. - Error messages should include the attempted path and a hint on how to fix it.
Root cause:
- One or more config files include an absolute
projectpath referencing the author's machine. scripts/run.py passes that value to utils/imports.import_module_from_path which expects a package directory containing__init__.py. The absolute path is invalid on other machines so the helper raises FileNotFoundError.
Proposed fixes:
- Update configs to avoid absolute author-specific paths (use
project: "."or env/template variables). - Harden scripts/run.py:
- Normalize and resolve
project(expanduser, resolve) and treat relative paths relative to repo root or script location. - Provide a clearer error message if
__init__.pyis missing (show attempted path and guidance).
- Normalize and resolve
- Search repository for and remove any remaining hardcoded
/home/surajpaths.
Workaround:
- Set
project: "."in configs and run the command from the repository root, or setprojectto the absolute path of your local repo.
Metadata
Metadata
Assignees
Labels
No labels