theano.test() fails with nvcc error - nvcc fatal :

2019-09-04 12:51发布

问题:

I'm installing Theano into an Ananconda environment and seem to have run into an install issue I don't understand. After I create the environment I run theano.test() and get the following error:

ERROR:theano.sandbox.cuda:Failed to compile cuda_ndarray.cu: ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH=m11b90075e2397c684f9dc0f7276eab8f,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC -Xlinker -rpath,/home/brad/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-3.5.2-64/cuda_ndarray -I/home/brad/anaconda3/envs/theano1/lib/python3.5/site-packages/theano/sandbox/cuda -I/home/brad/anaconda3/envs/theano1/lib/python3.5/site-packages/numpy/core/include -I/home/brad/anaconda3/envs/theano1/include/python3.5m -o /home/brad/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-3.5.2-64/cuda_ndarray/cuda_ndarray.so mod.cu -L/home/brad/anaconda3/envs/theano1/lib -lpython3.5m -lcublas -lcudart')

If I run the quoted nvcc command from the command line, I get:

nvcc fatal   : Don't know what to do with 'NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC'

The CUDA install seems to be working. I can compile and run all the CUDA examples, run deviceQuery and do a bandwidth test successfully. I get the same error inside or outside of my Anaconda environment and with python 2.7 or 3.5. Theano.test(0) seems to be running fine except for the nvcc error.(still running) The error is triggered with just theano.test(), but it is also triggered if I also import Keras and run 'from keras.models import Sequential'

I noticed there are a lot of unanswered Theano install questions, but hopefully this issue is not unique to me. I haven't had much luck googling a solution.

Ubuntu 16.04, Anaconda Python 3.5.2 (or 2.7), CUDA 7.5.17,

decorator                 4.0.10                   py35_0  
ipykernel                 4.3.1                    py35_0  
ipython                   5.0.0                    py35_0  
ipython_genutils          0.1.0                    py35_0  
jupyter_client            4.3.0                    py35_0  
jupyter_core              4.1.0                    py35_0  
libgfortran               3.0.0                         1  
libsodium                 1.0.10                        0  
mkl                       11.3.3                        0  
nose                      1.3.7                    py35_1  
numpy                     1.10.4                   py35_2  
openssl                   1.0.2h                        1  
path.py                   8.2.1                    py35_0  
pexpect                   4.0.1                    py35_0  
pickleshare               0.7.3                    py35_0  
pip                       8.1.2                    py35_0  
prompt_toolkit            1.0.3                    py35_0  
ptyprocess                0.5.1                    py35_0  
pygments                  2.1.3                    py35_0  
python                    3.5.2                         0  
pyzmq                     15.3.0                   py35_0  
readline                  6.2                           2  
scipy                     0.17.1              np110py35_1  
setuptools                25.1.6                   py35_0  
simplegeneric             0.8.1                    py35_1  
six                       1.10.0                   py35_0  
sqlite                    3.13.0                        0  
theano                    0.7.0               np110py35_0  
tk                        8.5.18                        0  
tornado                   4.4.1                    py35_0  
traitlets                 4.2.2                    py35_0  
wcwidth                   0.1.7                    py35_0  
wheel                     0.29.0                   py35_0  
xz                        5.2.2                         0  
zeromq                    4.1.4                         0  
zlib                      1.2.8                         3