facebookresearch / facebookresearch/sam2

SAM2 is unable to find packages installed on my system.

Open
#515 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
19.9k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hi there!

Hopefully this is an easy one. ;)

When I run python -m build --wheel --no-isolation in the source directory, I get the following output:
```
==> Starting build()...
Building phase
* Getting build dependencies for wheel...
running egg_info
writing SAM_2.egg-info/PKG-INFO
writing dependency_links to SAM_2.egg-info/dependency_links.txt
writing requirements to SAM_2.egg-info/requires.txt
writing top-level names to SAM_2.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
adding license file 'LICENSE_cctorch'
writing manifest file 'SAM_2.egg-info/SOURCES.txt'

ERROR Missing dependencies:
torch>=2.5.1
sympy==1.13.1
==> ERROR: A failure occurred in build().
Aborting...
```

This would indicate to me that I have a missing torch and sympy. However, both of these are installed on the system, and of the proper version.

sympy first:
```
[evert@Evert python-sam2-git]$ yay -Qi python-sympy
Name : python-sympy
Version : 1.13.3-2
Description : Symbolic manipulation package (Computer Algebra System), written in pure Python
Architecture : any
URL : https://sympy.org/en/index.html
Licenses : BSD
Groups : None
Provides : None
Depends On : python-mpmath
Optional Deps : ipython: user friendly interface for isympy
python-symengine: optimized backend, set USE_SYMENGINE=1 to use
Required By : python-pytorch-cuda python-torchvision-cuda
Optional For : python-fonttools python-networkx
Conflicts With : None
Replaces : None
Installed Size : 93.30 MiB
Packager : Jelle van der Waa
Build Date : 2024-11-16T22:45:55 CAT
Install Date : 2024-12-22T18:02:34 CAT
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By : Signature
```

It seems to be installed in /usr/lib/python3.13/site-packages:
```
[evert@Evert python-sam2-git]$ ls /usr/lib/python3.13/site-packages/ | grep sympy
isympy.py
sympy
sympy-1.13.3.dist-info
[evert@Evert python-sam2-git]$
```

torch next:
```
[evert@Evert python-sam2-git]$ yay -Qi python-pytorch-cuda
Name : python-pytorch-cuda
Version : 2.5.1-7
Description : Tensors and Dynamic neural networks in Python with strong GPU acceleration (with
CUDA)
Architecture : x86_64
URL : https://pytorch.org
Licenses : BSD
Groups : None
Provides : python-pytorch=2.5.1
Depends On : google-glog gflags opencv openmp openmpi pybind11 python python-yaml
libuv python-numpy python-sympy protobuf ffmpeg qt6-base eigen
intel-oneapi-mkl python-typing_extensions numactl python-jinja
python-networkx python-filelock cuda nccl cudnn magma-cuda onednn
Optional Deps : None
Required By : python-torchvision-cuda whisper-git
Optional For : None
Conflicts With : python-pytorch
Replaces : None
Installed Size : 2.08 GiB
Packager : Robin Candau
Build Date : 2024-12-19T19:16:58 CAT
Install Date : 2025-01-02T07:57:47 CAT
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature
```

This package is also installed in /usr/lib/python3.13/site-packages:
```
[evert@Evert python-sam2-git]$ ls /usr/lib/python3.13/site-packages/ | grep torch
functorch
torch
torch-2.5.1-py3.13.egg-info
torchgen
torchvision
torchvision-0.20.1a0-py3.13.egg-info
```

What am I doing wrong here? Are there any switches that I can set so that sam2 finds the installed packages?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.