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

pip install not working due to cuda.h missing error #21

Closed
ycemsubakan opened this issue Jan 19, 2018 · 13 comments
Closed

pip install not working due to cuda.h missing error #21

ycemsubakan opened this issue Jan 19, 2018 · 13 comments

Comments

@ycemsubakan
Copy link

I have tried pip install pytorch-fft, on two different machines with gpus, and on both I am getting this error:
venv/local/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:9:18: fatal error: cuda.h: No such file or directory

I tried python 2.7 and 3.6. I also tried to install without using a virtual environment.

P.S.: I first got the error which says the package cffi was missing. I installed that package, and now I am getting this error.

I would appreciate your help!

@riceric22
Copy link
Member

You also need to have cuda installed, cuda.h is a dependency from cuda

@ycemsubakan
Copy link
Author

ycemsubakan commented Jan 21, 2018

I know, I am using cuda 8.0 For some reason it is not accessing cuda.h . (Pytorch runs on the gpu with cuda 8.0)

@riceric22
Copy link
Member

Make sure cuda.h is in your path

@ycemsubakan
Copy link
Author

Okay, I have added this to my path:
/usr/local/cuda-8.0/targets/x86_64-linux/include/cuda.h

And it still doesn't work, I am getting the same error. Is this the exact path I am supposed to add?

I think the error says that the installation looks at this directory and cannot find cuda.h:
~/venv3.6/lib/python3.6/site-packages/torch/lib/include/THC

And there is no cuda.h under this directory... What should I do?

@riceric22
Copy link
Member

Try following the instructions on the cuda quick start guide, they describe how you can update your corresponding path variables (you'll need both path and ld_library_path)

http://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html

@ycemsubakan
Copy link
Author

Path and ld_library_path are properly set-up for me. As I have said, my pytorch works perfectly fine with cuda.

@riceric22
Copy link
Member

Can you try making a soft link from /usr/local/cuda/ to /usr/local/cuda-8.0/ ?

@ycemsubakan
Copy link
Author

ycemsubakan commented Jan 23, 2018

Alright, creating the soft link worked. Thank you!

I am closing the issue.

@jzbontar
Copy link

I had the same issue. I resolved it by exporting some environmental variables:

$ export C_INCLUDE_PATH=${CUDA_HOME}/include:${C_INCLUDE_PATH}
$ export LIBRARY_PATH=${CUDA_HOME}/lib64:$LIBRARY_PATH
$ pip install pytorch-fft

@stefbraun
Copy link

@ycemsubakan , how did you create the soft link? can you give the command please?

@wonderingabout
Copy link

wonderingabout commented Dec 25, 2018

the fix for me was to install sudo apt-get install nvidia-cuda-toolkit after sudo apt-get install -y cuda-9.0

also on a brand new ubuntu it is not needed to install nvidia-384, just install cuda-9.0 and graphics driver is included in it

all steps from here :
https://medium.com/@mishra.thedeepak/cuda-and-cudnn-installation-for-tensorflow-gpu-79beebb356d2
and here (change to 3.0.4) :
https://kezunlin.me/post/dacc4196/

now pycuda works (for tensorrt 3.0.4 tar file install on ubuntu 16.04 - cuda 9.0 deb - cudnn 7.0.5 deb)

pycuda works

@Saif-Alhaider
Copy link

Could not find any cudnn.h matching version '7' in any subdirectory:
''
'include'
'include/cuda'
'include/*-linux-gnu'
'extras/CUPTI/include'
'include/cuda/CUPTI'
of:
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1'
Asking for detailed CUDA configuration..
same error please help

@hoangdh
Copy link

hoangdh commented Mar 11, 2021

I had the same issue. I resolved it by exporting some environmental variables:

$ export C_INCLUDE_PATH=${CUDA_HOME}/include:${C_INCLUDE_PATH}
$ export LIBRARY_PATH=${CUDA_HOME}/lib64:$LIBRARY_PATH
$ pip install pytorch-fft

Additional, you must set CUDA_HOME and add it to $PATH.

export CUDA_HOME=/usr/local/cuda
export PATH=${PATH}:${CUDA_HOME}/bin

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