I’m trying to get Meta’s SAM2 model running in my Jetson, the model is published at:
With simple, straightforward setup instructions:
pip install -e .
However I get the following errors:
Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///home/souf/Desktop/segment-anything-2
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [26 lines of output]
/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/torch/_subclasses/functional_tensor.py:258: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
cpu = _conversion_method_template(device=torch.device("cpu"))
Traceback (most recent call last):
File "/home/souf/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/souf/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/souf/.local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
return hook(config_settings)
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 458, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 70, in <module>
File "<string>", line 51, in get_extensions
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1076, in CUDAExtension
library_dirs += library_paths(cuda=True)
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1207, in library_paths
if (not os.path.exists(_join_cuda_home(lib_dir)) and
File "/tmp/pip-build-env-5750y179/overlay/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 2416, in _join_cuda_home
raise OSError('CUDA_HOME environment variable is not set. '
OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Platform is Jetson Orin Nano with Jetpack 6, Torch & Torchvision with Cuda support downloaded and tested.
I should also mention that the setup in a Google Colab T4 instance went without issue, so I doubt this has something to do with the packages.
EDIT: the error is complaining about CUDA_HOME not being set, however CUDA is installed and working, torch and torchvision are as well, and I manually set the CUDA_HOME variable to CUDA root path, I also set it as a global variable for all users, just in case pip was doing something with different users, but it did not help.