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

OSError: CUDA_HOME environment variable is not set #7

Open
osainz59 opened this issue Sep 10, 2020 · 7 comments
Open

OSError: CUDA_HOME environment variable is not set #7

osainz59 opened this issue Sep 10, 2020 · 7 comments

Comments

@osainz59
Copy link

osainz59 commented Sep 10, 2020

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?

@Suryavf
Copy link

Suryavf commented Oct 4, 2020

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.

@osainz59
Copy link
Author

osainz59 commented Oct 4, 2020

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.

@Suryavf
Copy link

Suryavf commented Oct 4, 2020

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?

@listener17
Copy link

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

@DanqingZ
Copy link

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

@osainz59
Copy link
Author

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.

@barbarianxs
Copy link

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

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

No branches or pull requests

5 participants