Skip to content
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

When I run pip install --no-build-isolation -e . #56

Closed
RCLaplace opened this issue Jul 31, 2024 · 17 comments
Closed

When I run pip install --no-build-isolation -e . #56

RCLaplace opened this issue Jul 31, 2024 · 17 comments

Comments

@RCLaplace
Copy link

Obtaining file:///D:/work/2024/7/sam2
Checking if build backend supports build_editable ... done
Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: torch>=2.3.1 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (2.4.0+cu124)
Requirement already satisfied: torchvision>=0.18.1 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (0.19.0+cu124)
Requirement already satisfied: numpy>=1.24.4 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (1.26.3)
Collecting tqdm>=4.66.1 (from SAM-2==1.0)
Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB)
Collecting hydra-core>=1.3.2 (from SAM-2==1.0)
Using cached hydra_core-1.3.2-py3-none-any.whl.metadata (5.5 kB)
Collecting iopath>=0.1.10 (from SAM-2==1.0)
Using cached iopath-0.1.10-py3-none-any.whl
Requirement already satisfied: pillow>=9.4.0 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (10.2.0)
Collecting omegaconf<2.4,>=2.2 (from hydra-core>=1.3.2->SAM-2==1.0)
Using cached omegaconf-2.3.0-py3-none-any.whl.metadata (3.9 kB)
Collecting antlr4-python3-runtime==4.9.* (from hydra-core>=1.3.2->SAM-2==1.0)
Using cached antlr4_python3_runtime-4.9.3-py3-none-any.whl
Collecting packaging (from hydra-core>=1.3.2->SAM-2==1.0)
Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Requirement already satisfied: typing-extensions in d:\work\env\sam2\lib\site-packages (from iopath>=0.1.10->SAM-2==1.0) (4.9.0)
Collecting portalocker (from iopath>=0.1.10->SAM-2==1.0)
Using cached portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB)
Requirement already satisfied: filelock in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.13.1)
Requirement already satisfied: sympy in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (1.12)
Requirement already satisfied: networkx in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.2.1)
Requirement already satisfied: jinja2 in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.1.3)
Requirement already satisfied: fsspec in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (2024.2.0)
Collecting colorama (from tqdm>=4.66.1->SAM-2==1.0)
Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting PyYAML>=5.1.0 (from omegaconf<2.4,>=2.2->hydra-core>=1.3.2->SAM-2==1.0)
Using cached PyYAML-6.0.1-cp310-cp310-win_amd64.whl.metadata (2.1 kB)
Requirement already satisfied: MarkupSafe>=2.0 in d:\work\env\sam2\lib\site-packages (from jinja2->torch>=2.3.1->SAM-2==1.0) (2.1.5)
Collecting pywin32>=226 (from portalocker->iopath>=0.1.10->SAM-2==1.0)
Using cached pywin32-306-cp310-cp310-win_amd64.whl.metadata (6.6 kB)
Requirement already satisfied: mpmath>=0.19 in d:\work\env\sam2\lib\site-packages (from sympy->torch>=2.3.1->SAM-2==1.0) (1.3.0)
Using cached hydra_core-1.3.2-py3-none-any.whl (154 kB)
Using cached tqdm-4.66.4-py3-none-any.whl (78 kB)
Using cached omegaconf-2.3.0-py3-none-any.whl (79 kB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached portalocker-2.10.1-py3-none-any.whl (18 kB)
Using cached pywin32-306-cp310-cp310-win_amd64.whl (9.2 MB)
Using cached PyYAML-6.0.1-cp310-cp310-win_amd64.whl (145 kB)
Building wheels for collected packages: SAM-2
Building editable for SAM-2 (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building editable for SAM-2 (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [83 lines of output]
running editable_wheel
creating C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info
writing C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\PKG-INFO
writing dependency_links to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\dependency_links.txt
writing requirements to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\requires.txt
writing top-level names to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\top_level.txt
writing manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt'
D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt'
adding license file 'LICENSE'
adding license file 'LICENSE_cctorch'
writing manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt'
creating 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2-1.0.dist-info'
D:\work\Env\sam2\lib\site-packages\wheel\bdist_wheel.py:109: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")):
creating C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2-1.0.dist-info\WHEEL
running build_py
running build_ext
D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py:380: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。
warnings.warn(f'Error checking compiler version for {compiler}: {error}')
Traceback (most recent call last):
File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 156, in run
self._create_wheel_file(bdist_wheel)
File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 345, in _create_wheel_file
files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 268, in _run_build_commands
self._run_build_subcommands()
File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 295, in _run_build_subcommands
self.run_command(name)
File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "D:\work\Env\sam2\lib\site-packages\setuptools\dist.py", line 1001, in run_command
super().run_command(command)
File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command
cmd_obj.run()
File "D:\work\Env\sam2\lib\site-packages\setuptools\command\build_ext.py", line 88, in run
_build_ext.run(self)
File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run
self.build_extensions()
File "D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py", line 518, in build_extensions
_check_cuda_version(compiler_name, compiler_version)
File "D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py", line 397, in _check_cuda_version
cuda_version_str = subprocess.check_output([nvcc, '--version']).strip().decode(*SUBPROCESS_DECODE_ARGS)
File "E:\software\python3.10\lib\subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "E:\software\python3.10\lib\subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "E:\software\python3.10\lib\subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\software\python3.10\lib\subprocess.py", line 1456, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
D:\work\Env\sam2\lib\site-packages\setuptools_distutils\dist.py:988: _DebuggingTips: Problem in editable installation.
!!

          ********************************************************************************
          An error happened while installing `SAM 2` in editable mode.

          The following steps are recommended to help debug this problem:

          - Try to install the project normally, without using the editable mode.
            Does the error still persist?
            (If it does, try fixing the problem before attempting the editable mode).
          - If you are using binary extensions, make sure you have all OS-level
            dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
          - Try the latest version of setuptools (maybe the error was already fixed).
          - If you (or your project dependencies) are using any setuptools extension
            or customization, make sure they support the editable mode.

          After following the steps above, if the problem still persists and
          you think this is related to how setuptools handles editable installations,
          please submit a reproducible example
          (see https://stackoverflow.com/help/minimal-reproducible-example) to:

              https://github.com/pypa/setuptools/issues

          See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
          ********************************************************************************

  !!
    cmd_obj.run()
  error: [WinError 2] 系统找不到指定的文件。
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building editable for SAM-2
Failed to build SAM-2
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (SAM-2)

@RCLaplace
Copy link
Author

if I try pip install -e .

(sam2) PS D:\work\2024\7\sam2> pip install -e .
Obtaining file:///D:/work/2024/7/sam2
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]
C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\torch_subclasses\functional_tensor.py:258: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\utils\tensor_numpy.cpp:84.)
cpu = _conversion_method_template(device=torch.device("cpu"))
Traceback (most recent call last):
File "D:\work\Env\sam2\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "D:\work\Env\sam2\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "D:\work\Env\sam2\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 132, in get_requires_for_build_editable
return hook(config_settings)
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\setuptools\build_meta.py", line 458, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup
exec(code, locals())
File "", line 70, in
File "", line 51, in get_extensions
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\torch\utils\cpp_extension.py", line 1076, in CUDAExtension
library_dirs += library_paths(cuda=True)
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-packages\torch\utils\cpp_extension.py", line 1214, in library_paths
paths.append(_join_cuda_home(lib_dir))
File "C:\Users\v_ztfang\AppData\Local\Temp\pip-build-env-004yygl6\overlay\Lib\site-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.

@RCLaplace
Copy link
Author

(sam2) PS D:\work\2024\7\sam2> pip list
Package Version


filelock 3.13.1
fsspec 2024.2.0
Jinja2 3.1.3
MarkupSafe 2.1.5
mpmath 1.3.0
networkx 3.2.1
numpy 1.26.3
pillow 10.2.0
pip 24.2
setuptools 68.2.0
sympy 1.12
torch 2.4.0+cu124
torchaudio 2.4.0+cu124
torchvision 0.19.0+cu124
typing_extensions 4.9.0
wheel 0.41.2

cuda 12.4

@dehaozhou
Copy link

I also encountered the same problem.

@kaia-li
Copy link

kaia-li commented Jul 31, 2024

I also met the same error.

@SJLNNU
Copy link

SJLNNU commented Jul 31, 2024

I also encountered the same problem.
Installed pytorch using conda,without installing CUDA.
How to fix this ?

@someshfengde
Copy link

Getting the same error on M2 Air. Can't we use this without cuda?

@fritol
Copy link

fritol commented Jul 31, 2024

stinks

@fritol
Copy link

fritol commented Jul 31, 2024

worked for me:

install torch nightly!
install CUDA 12.1
run the sam2 pip command

@Zhui-Meng666
Copy link

The Win11 platform also encountered the same problem. The CUDA_COME environment variable was also set, but it was useless. How should I install it?

@Eranio-bit
Copy link

Have the same issue
File "C:\Users\user\AppData\Local\Temp\pip-build-env-cliwrnjy\overlay\Lib\site-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]

I have CUDA 12.1 with nightly installed in the main python env

@Guo1ZY
Copy link

Guo1ZY commented Aug 1, 2024

I have similar issue relating to this, since I run the command "pip install -e . " on ubuntu20.04, the other environment dependences seems downloading well, however the terminal report an error with cuda ==>" running build_ext
error: [Errno 2] No such file or directory: '/usr/local/cuda:/usr/local/cuda:/usr/local/cuda11.8/bin/nvcc'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
I set the environment on annaconda with python3.11 and cuda11.8,The CUDA_COME environment variable was set as well,
How should I solve this problem?

@SJLNNU
Copy link

SJLNNU commented Aug 2, 2024

I also encountered the same problem. Installed pytorch using conda,without installing CUDA. How to fix this ?

update my solution:
1 Installed CUDA=12.6 CUDNN
2 Set CUDA_HOME environment variable
3 run "pip install --no-build-isolation -e ."
4 #48

@jjun-2020
Copy link

I also encountered the same problem. Installed pytorch using conda,without installing CUDA. How to fix this ?

my torch version 2.3.1+cu121, Is it impossible to use (something) if CUDA is not installed?

@AmmoniumX
Copy link
Contributor

AmmoniumX commented Aug 5, 2024

Obtaining file:///D:/work/2024/7/sam2 Checking if build backend supports build_editable ... done Preparing editable metadata (pyproject.toml) ... done Requirement already satisfied: torch>=2.3.1 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (2.4.0+cu124) Requirement already satisfied: torchvision>=0.18.1 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (0.19.0+cu124) Requirement already satisfied: numpy>=1.24.4 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (1.26.3) Collecting tqdm>=4.66.1 (from SAM-2==1.0) Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB) Collecting hydra-core>=1.3.2 (from SAM-2==1.0) Using cached hydra_core-1.3.2-py3-none-any.whl.metadata (5.5 kB) Collecting iopath>=0.1.10 (from SAM-2==1.0) Using cached iopath-0.1.10-py3-none-any.whl Requirement already satisfied: pillow>=9.4.0 in d:\work\env\sam2\lib\site-packages (from SAM-2==1.0) (10.2.0) Collecting omegaconf<2.4,>=2.2 (from hydra-core>=1.3.2->SAM-2==1.0) Using cached omegaconf-2.3.0-py3-none-any.whl.metadata (3.9 kB) Collecting antlr4-python3-runtime==4.9.* (from hydra-core>=1.3.2->SAM-2==1.0) Using cached antlr4_python3_runtime-4.9.3-py3-none-any.whl Collecting packaging (from hydra-core>=1.3.2->SAM-2==1.0) Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB) Requirement already satisfied: typing-extensions in d:\work\env\sam2\lib\site-packages (from iopath>=0.1.10->SAM-2==1.0) (4.9.0) Collecting portalocker (from iopath>=0.1.10->SAM-2==1.0) Using cached portalocker-2.10.1-py3-none-any.whl.metadata (8.5 kB) Requirement already satisfied: filelock in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.13.1) Requirement already satisfied: sympy in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (1.12) Requirement already satisfied: networkx in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.2.1) Requirement already satisfied: jinja2 in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (3.1.3) Requirement already satisfied: fsspec in d:\work\env\sam2\lib\site-packages (from torch>=2.3.1->SAM-2==1.0) (2024.2.0) Collecting colorama (from tqdm>=4.66.1->SAM-2==1.0) Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB) Collecting PyYAML>=5.1.0 (from omegaconf<2.4,>=2.2->hydra-core>=1.3.2->SAM-2==1.0) Using cached PyYAML-6.0.1-cp310-cp310-win_amd64.whl.metadata (2.1 kB) Requirement already satisfied: MarkupSafe>=2.0 in d:\work\env\sam2\lib\site-packages (from jinja2->torch>=2.3.1->SAM-2==1.0) (2.1.5) Collecting pywin32>=226 (from portalocker->iopath>=0.1.10->SAM-2==1.0) Using cached pywin32-306-cp310-cp310-win_amd64.whl.metadata (6.6 kB) Requirement already satisfied: mpmath>=0.19 in d:\work\env\sam2\lib\site-packages (from sympy->torch>=2.3.1->SAM-2==1.0) (1.3.0) Using cached hydra_core-1.3.2-py3-none-any.whl (154 kB) Using cached tqdm-4.66.4-py3-none-any.whl (78 kB) Using cached omegaconf-2.3.0-py3-none-any.whl (79 kB) Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Using cached packaging-24.1-py3-none-any.whl (53 kB) Using cached portalocker-2.10.1-py3-none-any.whl (18 kB) Using cached pywin32-306-cp310-cp310-win_amd64.whl (9.2 MB) Using cached PyYAML-6.0.1-cp310-cp310-win_amd64.whl (145 kB) Building wheels for collected packages: SAM-2 Building editable for SAM-2 (pyproject.toml) ... error error: subprocess-exited-with-error

× Building editable for SAM-2 (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [83 lines of output] running editable_wheel creating C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info writing C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\PKG-INFO writing dependency_links to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\dependency_links.txt writing requirements to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\requires.txt writing top-level names to C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\top_level.txt writing manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt' D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py:495: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend. warnings.warn(msg.format('we could not find ninja.')) reading manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt' adding license file 'LICENSE' adding license file 'LICENSE_cctorch' writing manifest file 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2.egg-info\SOURCES.txt' creating 'C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2-1.0.dist-info' D:\work\Env\sam2\lib\site-packages\wheel\bdist_wheel.py:109: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")): creating C:\Users\v_ztfang\AppData\Local\Temp\pip-wheel-ekzsoghf.tmp-l40w_hdg\SAM_2-1.0.dist-info\WHEEL running build_py running build_ext D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py:380: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。 warnings.warn(f'Error checking compiler version for {compiler}: {error}') Traceback (most recent call last): File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 156, in run self._create_wheel_file(bdist_wheel) File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 345, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 268, in _run_build_commands self._run_build_subcommands() File "D:\work\Env\sam2\lib\site-packages\setuptools\command\editable_wheel.py", line 295, in _run_build_subcommands self.run_command(name) File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\work\Env\sam2\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\work\Env\sam2\lib\site-packages\setuptools\command\build_ext.py", line 88, in run _build_ext.run(self) File "D:\work\Env\sam2\lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run self.build_extensions() File "D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py", line 518, in build_extensions _check_cuda_version(compiler_name, compiler_version) File "D:\work\Env\sam2\lib\site-packages\torch\utils\cpp_extension.py", line 397, in _check_cuda_version cuda_version_str = subprocess.check_output([nvcc, '--version']).strip().decode(*SUBPROCESS_DECODE_ARGS) File "E:\software\python3.10\lib\subprocess.py", line 421, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "E:\software\python3.10\lib\subprocess.py", line 503, in run with Popen(*popenargs, **kwargs) as process: File "E:\software\python3.10\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "E:\software\python3.10\lib\subprocess.py", line 1456, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] 系统找不到指定的文件。 D:\work\Env\sam2\lib\site-packages\setuptools_distutils\dist.py:988: _DebuggingTips: Problem in editable installation. !!

          ********************************************************************************
          An error happened while installing `SAM 2` in editable mode.

          The following steps are recommended to help debug this problem:

          - Try to install the project normally, without using the editable mode.
            Does the error still persist?
            (If it does, try fixing the problem before attempting the editable mode).
          - If you are using binary extensions, make sure you have all OS-level
            dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
          - Try the latest version of setuptools (maybe the error was already fixed).
          - If you (or your project dependencies) are using any setuptools extension
            or customization, make sure they support the editable mode.

          After following the steps above, if the problem still persists and
          you think this is related to how setuptools handles editable installations,
          please submit a reproducible example
          (see https://stackoverflow.com/help/minimal-reproducible-example) to:

              https://github.com/pypa/setuptools/issues

          See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
          ********************************************************************************

  !!
    cmd_obj.run()
  error: [WinError 2] 系统找不到指定的文件。
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building editable for SAM-2 Failed to build SAM-2 ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (SAM-2)

Have you tried pip install --upgrade ninja wheel? Then run pip install --no-build-isolation -e . again

@RCLaplace
Copy link
Author

pip install --upgrade ninja wheel

I tired it but still got the same error

@ronghanghu
Copy link
Contributor

ronghanghu commented Aug 7, 2024

Hi @RCLaplace @SJLNNU @kaia-li @Zhui-Meng666 @Zhui-Meng666 @jjun-2020 @Guo1ZY @Eranio-bit @someshfengde , 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 INSTALL.md for details).

@someshfengde
Copy link

thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests