I am trying to export some environment variables in Unix using .bash_profile
It reads now like this:
export PATH=${PATH}:/usr/local/cuda-6.0/bin/
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
After that I try to run a python script that uses these variables
python
>>> import theano
And I get this error:
ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.
Then I exit python, re-run manually the first line of .bash_profile
and it works.
If I change the order of the exports like this:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
export PATH=${PATH}:/usr/local/cuda-6.0/bin/
And try one more time to import theano from python I get this error:
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: libcublas.so.6.0: cannot open shared object file: No such file or directory
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: cuda unavilable)
Which indicates that export LD_LIBRARY_PATH
didn't work. I do the same procedure as before, exit python re-run the first line and then it imports correctly.
Adding the first export to the last line of the bash script (exporting twice) makes this first/third export work well but not the second, that is, only the last export is working properly.
I've tried doing echo commmands on the variables and it was printing normally as if they were correctly set, but I'm unable to use them with python. Also, when re-setting them manually that doesn't double export them, but re-re-setting does:
-bash-4.2$ echo $LD_LIBRARY_PATH
:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
-bash-4.2$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
-bash-4.2$ echo $LD_LIBRARY_PATH
:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
-bash-4.2$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
-bash-4.2$ echo $LD_LIBRARY_PATH
:/usr/local/cuda-6.0/targets/x86_64-linux/lib/:/usr/local/cuda-6.0/targets/x86_64-linux/lib/
I've actually solved this issue by re-setting the PATH
variable inside the python script, but it bothers me that I can't find the reason why this is happening
Some info:
-bash-4.2$ bash --version
GNU bash, version 4.2.53(1)-release (x86_64-redhat-linux-gnu)
-bash-4.2$ cat /etc/*-release
Fedora release 19 (Schrödinger’s Cat)