Skip to content
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

Module Not Found Error #42

Open
aiEnthusiast2024 opened this issue Jan 9, 2025 · 5 comments
Open

Module Not Found Error #42

aiEnthusiast2024 opened this issue Jan 9, 2025 · 5 comments

Comments

@aiEnthusiast2024
Copy link

Hi! Has someone else had this issue before? I have cloned the main repo. Due to a time-out error, I had to clone the git submodules (sam and segment_anything modules) separately and then a "git submodule init" followed by a "git submodule update --recursive" command.

When I run the inference script, I'm getting the following error:
" from segment_anything.modeling import Sam
ModuleNotFoundError: No module named 'segment_anything'
"
Any help in solving this issue is appreciated. Thank you!

@Nodemana
Copy link

I am stuck on the same sort of thing. Don't you also think its strange that the two sub-modules are actually the same segment-anything-road repository but they are just named differently.

@Nodemana
Copy link

Nodemana commented Jan 13, 2025

@aiEnthusiast2024 Hey mate I have solved this issue. The way I got the imports working is by going into the file that's causing the issue. For me its sam/segment_anything/predictor.py and changing the import path from segment_anything.modeling import Sam to the correct path which is from .modeling.sam import Sam.

@aiEnthusiast2024
Copy link
Author

@aiEnthusiast2024 Hey mate I have solved this issue. The way I got the imports working is by going into the file that's causing the issue. For me its sam/segment_anything/predictor.py and changing the import path from segment_anything.modeling import Sam to the correct path which is from .modeling.sam import Sam.

@Nodemana Hey! Thanks for your reply. Yes, after I posted that message, I was able to get past that issue by changing the path to the module as well.

@htcr
Copy link
Owner

htcr commented Jan 17, 2025

@aiEnthusiast2024 Hey mate I have solved this issue. The way I got the imports working is by going into the file that's causing the issue. For me its sam/segment_anything/predictor.py and changing the import path from segment_anything.modeling import Sam to the correct path which is from .modeling.sam import Sam.

Thanks for helping out! Will try to clean the code further and make a requirement.txt. But if you are interested, feel free to create a PR too,

@Nodemana
Copy link

Nodemana commented Jan 18, 2025

No worries, I'll do one now.

EDIT: I would really like to do this pull request but I am a little confused because the line that needs changing is actually apart of the submodule segment-anything-road not this repo. So I should make the pull request there???

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

No branches or pull requests

3 participants