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

CUDA_HOME environment variable is not set #26

Closed
zzd1992 opened this issue Dec 14, 2018 · 8 comments
Closed

CUDA_HOME environment variable is not set #26

zzd1992 opened this issue Dec 14, 2018 · 8 comments

Comments

@zzd1992
Copy link

zzd1992 commented Dec 14, 2018

I work on ubuntu16.04, cuda9.0 and Pytorch1.0.
When I run your example code cuda/setup.py:

Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    'lltm_cuda_kernel.cu',
  File "/usr/local/lib/python2.7/dist-packages/torch/utils/cpp_extension.py", line 476, in CUDAExtension
    library_dirs += library_paths(cuda=True)
  File "/usr/local/lib/python2.7/dist-packages/torch/utils/cpp_extension.py", line 549, in library_paths
    paths.append(_join_cuda_home(lib_dir))
  File "/usr/local/lib/python2.7/dist-packages/torch/utils/cpp_extension.py", line 1121, in _join_cuda_home
    raise EnvironmentError('CUDA_HOME environment variable is not set. '
EnvironmentError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.

However, I am sure cuda9.0 in my computer is installed correctly.
How to fix this problem?

@goldsborough
Copy link
Contributor

That's odd. Maybe you have an unusual install location for CUDA. Either way, just setting CUDA_HOME to your cuda install path before running python setup.py should work: CUDA_HOME=/path/to/your/cuda/home python setup.py install

@zzd1992
Copy link
Author

zzd1992 commented Dec 18, 2018

Thanks. My problem is solved.

@zzd1992 zzd1992 closed this as completed Dec 18, 2018
@zzd1992 zzd1992 reopened this Dec 18, 2018
@DaLei001
Copy link

@zzd1992 Could you tell how to solve the problem about "the CUDA_HOME environment variable is not set"?

@zzd1992
Copy link
Author

zzd1992 commented Aug 26, 2019

@DaLei001

CUDA_HOME=/path/to/your/cuda/home python setup.py install

This is worked in my situation.

@mmahdavian
Copy link

I am getting this error in a conda env on a server and I have cudatoolkit installed on the conda env. What should the CUDA_HOME be in my case.

@parasdegregore
Copy link

@mmahdavian cudatoolkit probably won't work for you, it doesn't provide access to low level c++ apis. You'd need to install CUDA using the official method.

@zzd1992 zzd1992 closed this as completed Aug 25, 2020
@ShoufaChen
Copy link

I got a similar error when using pycharm, with unusual cuda install location.

I just add the CUDA_HOME env and solve this problem.

@fengyuan1993012
Copy link

The problem could be solved by installing the whole cuda through the nvida website. and when installing it, you may come across some problem. then https://askubuntu.com/questions/1280205/problem-while-installing-cuda-toolkit-in-ubuntu-18-04/1315116#1315116?newreg=ec85792ef03b446297a665e21fff5735 the answer may be to help you. GOOD LUCK

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

7 participants