pytorch_block_sparse icon indicating copy to clipboard operation
pytorch_block_sparse copied to clipboard

OSError: CUDA_HOME environment variable is not set

Open osainz59 opened this issue 5 years ago • 7 comments

Hi

I tried to install the package using the following command but I got OSError.

python -m pip install pytorch_block_sparse

The error is the following:

Collecting pytorch_block_sparse
  Using cached pytorch_block_sparse-0.1.2.tar.gz (82 kB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\osain\Anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\osain\\AppData\\Local\\Temp\\pip-install-i8p45fhk\\pytorch-block-sparse\\setup.py'"'"'; __file__='"'"'C:\\Users\\osain\\AppData\\Local\\Temp\\pip-install-i8p45fhk\\pytorch-block-sparse\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\osain\AppData\Local\Temp\pip-pip-egg-info-_3vgf_fn'
         cwd: C:\Users\osain\AppData\Local\Temp\pip-install-i8p45fhk\pytorch-block-sparse\
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\osain\AppData\Local\Temp\pip-install-i8p45fhk\pytorch-block-sparse\setup.py", line 33, in <module>
        extra_compile_args=['-I', '%s/pytorch_block_sparse' % rootdir]
      File "C:\Users\osain\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 705, in CUDAExtension
        library_dirs += library_paths(cuda=True)
      File "C:\Users\osain\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 802, in library_paths
        paths.append(_join_cuda_home(lib_dir))
      File "C:\Users\osain\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1652, in _join_cuda_home
        raise EnvironmentError('CUDA_HOME environment variable is not set. '
    OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Enviroment:

  • OS: Windows 10
  • Python version: 3.7.3
  • CUDA version: 10.1

I think it could happen because I installed pytorch with CUDA using conda. Do I need to set up CUDA_HOME environment variable manually? Where could I find the instalation?

osainz59 avatar Sep 10 '20 19:09 osainz59

Same problem in Ubuntu 18.04

OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Suryavf avatar Oct 04 '20 04:10 Suryavf

Same problem in Ubuntu 18.04

OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Do you have installed PyTorch+CUDA via conda? I think that could be the reason.

osainz59 avatar Oct 04 '20 13:10 osainz59

Same problem in Ubuntu 18.04

OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Do you have installed PyTorch+CUDA via conda? I think that could be the reason.

Yes, is there a solution for Conda?

Suryavf avatar Oct 04 '20 16:10 Suryavf

I have same problem as reported above, for both Windows and Linux.

listener17 avatar Oct 05 '20 08:10 listener17

Maybe try export CUDA_HOME=/usr/local/cuda-10.1/?

DanqingZ avatar Nov 11 '20 07:11 DanqingZ

Maybe try export CUDA_HOME=/usr/local/cuda-10.1/?

That should work, but the problem comes when installing cuda with conda and not being able to find the installation path.

osainz59 avatar Nov 11 '20 10:11 osainz59

i have the same quesion and i use win10 like you,not linux system, so finally have you solved it?

barbarianxs avatar Mar 23 '22 06:03 barbarianxs