📅 2015-Jul-31 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, installation, nvcc, path, pip, pycuda, sudo ⬩ 📚 Archive
pip
:$ sudo pip install pycuda
In file included from src/cpp/cuda.cpp:1:0:
src/cpp/cuda.hpp:14:18: fatal error: cuda.h: No such file or directory
#include <cuda.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
CUDA_ROOT
and had added the bin
path of CUDA installation to PATH
environment variable. So, the installer should have found cuda.h
which I could see was present in $CUDA_ROOT/include
$ sudo pip -vvv install pycuda
nvcc
.setup.py
, I saw that the check for nvcc
was used to figure out the CUDA_ROOT
and CUDA_INC_DIR
.nvcc
was not visible was that CUDA_ROOT
was set for my user, but this PATH
is not visible when a command is run under sudo
, as described here. The solution was to make the CUDA bin
path visible to sudo
.To make the $CUDA_ROOT/bin
available in PATH
for sudo
, we can follow the steps described here. For example, on my system with CUDA 7.0 I followed these steps:
/etc/profile.d/cuda.sh
and added this line:export PATH=/usr/local/cuda-7.0/bin:$PATH
root
shell without resetting PATH
and ran the pip installation:$ sudo su -
$ pip install pycuda
This worked and PyCUDA was installed successfully.
Tried with: PyCUDA 2015.1.2, CUDA 7.0 and Ubuntu 14.04