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

error importing sam2 #496

Open
qycherry opened this issue Dec 16, 2024 · 1 comment
Open

error importing sam2 #496

qycherry opened this issue Dec 16, 2024 · 1 comment

Comments

@qycherry
Copy link

qycherry commented Dec 16, 2024

I get error with following lines:
from sam2.build_sam import build_sam2
from sam2.sam2_image_predictor import SAM2ImagePredictor
the message says:Unresolved reference 'sam2'
I have already excuted the command : pip install -e ".[notebooks]"
but I still can not import the package “sam2”

and another question,why is the root directory doesn't contain init.py,is this the reason?

could you please help?thanks

@ronghanghu
Copy link
Contributor

Hi @qycherry, it's likely because the installation didn't work properly. In case reinstallation doesn't resolve the issue, you can try manually adding it to the path as follows

export PYTHONPATH=<your-path-to-sam2-repo>

where <your-path-to-sam2-repo> is the repo path you cloned that contains the sam2 directory.

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

2 participants