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__.py in U:\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:
project should resolve to the local repository root (or a user-specified path on the current machine), not an author-specific absolute path.
- If
project is 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
project path 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__.py is missing (show attempted path and guidance).
- Search repository for and remove any remaining hardcoded
/home/suraj paths.
Workaround:
- Set
project: "." in configs and run the command from the repository root, or set project to the absolute path of your local repo.
Running the CLI can fail because some configs contain an absolute, author-specific
projectpath (e.g./home/suraj/...). The import helper is passed that path and attempts to find__init__.pythere, causing a FileNotFoundError on other machines.Environment:
python -m scripts.run fit --config_file=./configs/train.yaml,./configs/models/primus.yaml,./configs/datasets/amos.yaml
Reproduction steps:
FileNotFoundError: No
__init__.pyinU:\home\suraj\Repositories\DINOv2_3D\__init__.pyActual behavior:
Expected behavior:
projectshould resolve to the local repository root (or a user-specified path on the current machine), not an author-specific absolute path.projectis relative (e.g. "."), resolve it relative to the repo root or CWD.Root cause:
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:
project: "."or env/template variables).project(expanduser, resolve) and treat relative paths relative to repo root or script location.__init__.pyis missing (show attempted path and guidance)./home/surajpaths.Workaround:
project: "."in configs and run the command from the repository root, or setprojectto the absolute path of your local repo.