-
Notifications
You must be signed in to change notification settings - Fork 959
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
Failed to build SAM-2 and RuntimeError in infer #18
Comments
I have the same problem |
I too have the same problem. I have installed the cuda toolkit 11.8, checked it from nvcc -V command and installed pytorch using 11.8 cuda too, but I still get the same error. |
You can upgrade your cuda to 12.1. Otherwise manually install the dependencies, e.g., pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118 |
@laiwenq Thank you for your reply. I have tried pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
pip install --no-build-isolation -e . Then I build SAM2 successfully, but failed to infer. |
did you solve it? |
Can you post what error you're seeing? I have no problem with torch==2.3.1 and cuda version 12.1, it is worth trying upgrade your cuda. |
@laiwenq @fangli333 @HB16888 @Kiran-valetcloset @ChinaStark |
perhaps, we need cuda 12+ for it to run? |
You have to update gcc to version 9.3 or higher.. worked for me! worth a try. |
I have tested gcc-9/10/11 none of them worked. finally upgrade cuda toolkit to 12.1 solved the problem
|
Indeed, so it seems the basic required config are something like: of course, this is assuming a GPU machine. if you have one or more missing in the above list, worth trying to fix that first |
Thank you for your reply. I have tried but failed to build. The error shows as follows. note: This error originates from a subprocess, and is likely not a problem with pip. My cuda version 12.1 bu it still not work. |
hello, do you solve it? |
Sorry just see this now. Check your cuda version by running nvcc -V in the command line and see if you are actually using 12.1. |
thanks! |
Hi, we have recently made the CUDA extension step optional (in https://github.com/facebookresearch/segment-anything-2/pull/155) as a workaround to this problem. You can pull the latest code and reinstall via # run the line below inside the SAM 2 repo
git pull;
pip uninstall -y SAM-2;
rm -f sam2/*.so;
pip install -e ".[demo]" which allows using SAM 2 without CUDA extension (the results should stay the same in most cases, see |
When I run the command
pip install -e .
There is an error:
I try to use the command below to fix this error:
pip install --no-build-isolation -e .
Although I build SAM-2 successfully, there is another error when I run the inference image segmentation script:
Does anyone have the same problem?
The text was updated successfully, but these errors were encountered: