facebookresearch / facebookresearch/sam2

Windows Installation Requires --no-build-isolation Flag to Avoid CUDA_HOME Error

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

Description

This is referring to a common problem mentioned on https://github.com/facebookresearch/segment-anything-2/issues/19

If you try to install via `pip install -e .` on Windows 11, you always get `OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.`. This happens regardless if you actually have CUDA_HOME or CUDA_PATH set.
The "fix" for this is to run `pip install --no-build-isolation -e .` instead, but this is not mentioned anywhere besides on the issue itself.

Ideally, the installation should not require the `--no-build-installation` flag to be present in order to work, but at the very least, the installation guide at https://github.com/facebookresearch/segment-anything-2#installation and/or https://github.com/facebookresearch/segment-anything-2/blob/main/INSTALL.md should inform Windows users about this requirement as a temporary workaround while the problem is being properly addressed.

Disclaimer: I can't guarantee that this flag is needed for every Windows environment, but looking at the reactions and comments from https://github.com/facebookresearch/segment-anything-2/issues/19 shows that it's a very common occurrence, and at the very least happens with the following system configuration:

- Microsoft Windows 11 Home 10.0.22631 Build 22631
- Python 3.12.4
- pip 24.2
- CUDA_HOME = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4
- torch==2.4.0+cu124
- torchaudio==2.4.0+cu124
- torchvision==0.19.0+cu124

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.