-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hydra not initializing - nested files causing install issue #346
Comments
Hi @nmbphys, thanks for reporting this! I think this is likely due to having a previous installation under a different site package path (installed without using the |
Same problem here, when installin in editable mode I get the following error:
If I rename PS: I tried pip uninstall SAM-2 and the reinstalling the repo again but didn't work Steps to reproduce:
Output:
|
Hi @danigarciaoca regarding this observation
I think it's likely because you're running the test in your Step 3 directly in the parent directory of the repo (i.e. the directory where this repo https://github.com/facebookresearch/sam2 is cloned into). If you move to another directory like your home directory, would the test work? |
Hi @ronghanghu, just tested from outside and it works. Thanks! So the question now is, why is it not working when run from the parent directory of the repo?
I don't really get why is this AsserionError rising when running from the parent directory. EDIT 1: I suppose that Getting Started instructions will lead to this same issue to everyone testing SAM-2 following the proposed order, won't they? EDIT 2: (from ignorance) Perhaps GlobalHydra initialization should be in another place other than |
Hi @danigarciaoca, in general it's often not advised to run Python directly from the parent dir where the repo is cloned into, since the repo dir could shadow the Python package dir if they have the same name. (Same is true for many common Python repos like https://github.com/numpy/numpy). I added a check in #359 to raise a more informative error in this case. |
… parent directory of the sam2 repo (facebookresearch#359) If the user has "sam2/sam2" in their path, they are likey importing the repo itself as "sam2" rather than importing the "sam2" python package (i.e. "sam2/sam2" directory). This typically happens because the user is running Python from the parent directory that contains the sam2 repo they cloned. In general, the user should not run Python from the parent dir when the repo is cloned into (same is true for e.g. Numpy repo that contains names like `numpy/numpy` where the module and the repo have the same name), as the user encountered in facebookresearch#346. (close facebookresearch#346)
This isn't a bug per se, but I ran into some errors with the exact location of the package directory. I cloned the repo today and followed the installation instructions in a conda environment (within PyCharm), then tried to create a SAM2ImagePredictor as in one of the examples. First, I got errors that hydra wasn't initialized. The init.py file wasn't even getting executed. When I initialized hydra manually, I then got the 'MissingConfigException' error.
I ended up having to copy the nested sam2 directory (sam2/sam2) into the site_packages directly so that it could actually find the package properly. I haven't worked directly with Python packages for a while, so maybe this is a well-known thing, but it might be worth a mentioning in INSTALL.md as a possible issue.
The text was updated successfully, but these errors were encountered: