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

I am getting this error when i do pip install -e . #99

Closed
varunvaidhiya opened this issue Aug 1, 2024 · 11 comments
Closed

I am getting this error when i do pip install -e . #99

varunvaidhiya opened this issue Aug 1, 2024 · 11 comments

Comments

@varunvaidhiya
Copy link

error: subprocess-exited-with-error

Getting requirements to build editable did not run successfully.
exit code: 1

[32 lines of output]
C:\Users\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\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 "C:\Users\varun\anaconda3\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()
File "C:\Users\varun\anaconda3\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 "C:\Users\varun\anaconda3\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\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\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\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\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\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "C:\Users\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\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\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\overlay\Lib\site-packages\torch\utils\cpp_extension.py", line 1076, in CUDAExtension
library_dirs += library_paths(cuda=True)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\overlay\Lib\site-packages\torch\utils\cpp_extension.py", line 1214, in library_paths
paths.append(_join_cuda_home(lib_dir))
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\varun\AppData\Local\Temp\pip-build-env-62f8d4eb\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.

@shamanicvocalarts
Copy link

Same, Have tried a lot of different steps to try and resolve including explicitly setting CUDA_HOME before running & get the same error

@MiessiGomes
Copy link

Set the path of CUDA_HOME on environment variables > on VS Code, change the default terminal pressing CTRL + SHIFT + P and typing "Terminal: Select Default Profile" and select Command Prompt.

Worked for me

@rongtianjie
Copy link

Set the path of CUDA_HOME on environment variables > on VS Code, change the default terminal pressing CTRL + SHIFT + P and typing "Terminal: Select Default Profile" and select Command Prompt.

Worked for me

Tried this. Still got same error. :(

@MiessiGomes
Copy link

MiessiGomes commented Aug 2, 2024

Set the path of CUDA_HOME on environment variables > on VS Code, change the default terminal pressing CTRL + SHIFT + P and typing "Terminal: Select Default Profile" and select Command Prompt.
Worked for me

Tried this. Still got same error. :(

Try doing these steps but using a conda environment, so you will need to install the dependencies using conda as well.
I managed to install it, but I'm stuck on an error that says SAM 2 only accepts .jpeg files, even though I've already generated the video frames in .jpeg

@ManuelSchenk
Copy link

ManuelSchenk commented Aug 2, 2024

Same issue here on WIn10 :-(

I get it working on WSL after installing CUDA TOOLKIT for Linux...

@simplyinquisitive
Copy link

follow this video https://www.youtube.com/watch?v=MIUxiLjoA1g worked for me

ronghanghu referenced this issue Aug 6, 2024
This is referring to https://github.com/facebookresearch/segment-anything-2/issues/137 , which in itself refers to a common problem during installation, mentioned on https://github.com/facebookresearch/segment-anything-2/issues/19 .

Some users may encounter significant trouble installing the project, running into the error `OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.`. Simply adding the `--no-build-isolation` flag to the pip install, e.g. `pip install --no-build-isolation -e .`, usually solves this problem. However, this fix is not mentioned anywhere within the readmes or installation troubleshooting docs. This PR adds this recommendation into the INSTALL.md file under the "My installation failed with `CUDA_HOME environment variable is not set` " section, ensuring that more users are aware of this potential fix.

Examples of users experiencing related difficulties when installing:
https://github.com/facebookresearch/segment-anything-2/issues/19
https://github.com/facebookresearch/segment-anything-2/issues/41
https://github.com/facebookresearch/segment-anything-2/issues/99
https://github.com/facebookresearch/segment-anything-2/issues/133
@szriru
Copy link

szriru commented Aug 8, 2024

👇👇

How to Apply UTF-8 for Non-Unicode Programs in Windows 11

  1. Open Settings:

    • Press Windows + I to open the Settings app.
  2. Navigate to Time & Language:

    • Click on Time & language in the left pane.
  3. Open Language & Region Settings:

    • Click on Language & region.
  4. Open Related Settings:

    • Scroll down to the Related settings section and click on Administrative language settings.
  5. Go to Administrative Settings:

    • In the Region window that opens, switch to the Administrative tab.
  6. Change System Locale:

    • Click on the Change system locale... button under the Language for non-Unicode programs section.
  7. Select UTF-8:

    • Check the box for Beta: Use Unicode UTF-8 for worldwide language support.
  8. Apply Changes:

    • Click OK to apply the changes.
    • Restart your computer
  9. try "pip install -e ." again in the folder

@ronghanghu
Copy link
Contributor

Hi, this is likely due to an error in building the SAM 2 CUDA extension. We have recently made the CUDA extension step optional (in https://github.com/facebookresearch/segment-anything-2/pull/155 and https://github.com/facebookresearch/segment-anything-2/pull/175) 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).

@MiessiGomes
Copy link

Hi, this is likely due to an error in building the SAM 2 CUDA extension. We have recently made the CUDA extension step optional (in #155 and #175) 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).

Without using CUDA, I'm still able to use the GPU to segment ?

@ronghanghu
Copy link
Contributor

@MiessiGomes Yes, you should still be able to use GPUs (it's just that the post-processing step based on the custom SAM 2 CUDA extension will be skipped, which shouldn't affect results in most cases)

@MiessiGomes
Copy link

Thanks dude

@MiessiGomes Yes, you should still be able to use GPUs (it's just that the post-processing step based on the custom SAM 2 CUDA extension will be skipped, which shouldn't affect results in most cases)

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

8 participants