Closed MattLiutt closed 3 months ago
Issue solved.
How did you solve it?
How did you solve it? same question
How ?
I fix this problem by installing pytorch=2.1.0, while I meet this problem by using pytorch=2.3.1. After changing the pytorch version, it works well.
How did you solve it? same question
just conda install pytorch=2.1.0?
I noticed that there are
_REQUIREDPACKAGES = [ "torch>=2.3.1",
in setpu.py, I'm confused. X﹏X
Another solution in #22 is running: python setup.py build_ext --inplace
.
It workd. ( •̀ ω •́ )✧
Do not work for me
(sam2) C:\Users\PS\Desktop\segment-anything-2>python setup.py clean --all CUDA_HOME in setup.py: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 running clean removing 'build\temp.win-amd64-cpython-310' (and everything under it) 'build\lib.win-amd64-cpython-310' does not exist -- can't clean it 'build\bdist.win-amd64' does not exist -- can't clean it 'build\scripts-3.10' does not exist -- can't clean it removing 'build'
(sam2) C:\Users\PS\Desktop\segment-anything-2>python setup.py build_ext --inplace CUDA_HOME in setup.py: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 running build_ext C:\Users\PS.conda\envs\sam2\lib\site-packages\torch\utils\cpp_extension.py:384: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified warnings.warn(f'Error checking compiler version for {compiler}: {error}') building 'sam2._C' extension creating C:\Users\PS\Desktop\segment-anything-2\build creating C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310 creating C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release creating C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2 creating C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2\csrc Emitting ninja build file C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/1] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc --generate-dependencies-with-compile --dependency-output C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2/csrc/connected_components.obj.d -std=c++17 --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /wd4624 -Xcompiler /wd4067 -Xcompiler /wd4068 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\TH -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IC:\Users\PS.conda\envs\sam2\include -IC:\Users\PS.conda\envs\sam2\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" -c C:\Users\PS\Desktop\segment-anything-2\sam2\csrc[connected_components.cu](http://connected_components.cu/) -o C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2/csrc/connected_components.obj -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -DCUDA_HAS_FP16=1 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_80,code=sm_80 FAILED: C:/Users/PS/Desktop/segment-anything-2/build/temp.win-amd64-cpython-310/Release/sam2/csrc/connected_components.obj C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc --generate-dependencies-with-compile --dependency-output C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2/csrc/connected_components.obj.d -std=c++17 --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /wd4624 -Xcompiler /wd4067 -Xcompiler /wd4068 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\TH -IC:\Users\PS.conda\envs\sam2\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -IC:\Users\PS.conda\envs\sam2\include -IC:\Users\PS.conda\envs\sam2\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" -c C:\Users\PS\Desktop\segment-anything-2\sam2\csrc[connected_components.cu](http://connected_components.cu/) -o C:\Users\PS\Desktop\segment-anything-2\build\temp.win-amd64-cpython-310\Release\sam2/csrc/connected_components.obj -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -DCUDA_HAS_FP16=1 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_80,code=sm_80 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include\crt/host_config.h(153): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk. connected_components.cu ninja: build stopped: subcommand failed. Traceback (most recent call last): File "C:\Users\PS.conda\envs\sam2\lib\site-packages\torch\utils\cpp_extension.py", line 2107, in _run_ninja_build subprocess.run( File "C:\Users\PS.conda\envs\sam2\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\PS\Desktop\segment-anything-2\setup.py", line 68, in
I tried to run the example under Colab, and encountered the following error when import _C.so from sam2. It would be helpful if you could provide some ideas on this issue.
Python version: 3.10 Environment: Google Colab with T4