Pycharm gives error on script that runs with terminal (Module: Tensorflow)

I have worked with tensorflow module (GPU version) in Pycharm. If I run the script from the terminal, it works as expected. However, when I run the script from pycharm, it says:

ImportError: libcudart.so.7.5: cannot open shared object file: No 
such file or directory

      

How do I resolve this?

enter image description here

enter image description here

The Pycharm interpreter shows tensorflow as a package.

In the terminal, when I check the tensorflow version, it was the same as in pycharm (0.10.0rc0)

+3


source to share


1 answer


It looks like your CUDA_HOME or LD_LIBRARY_PATH is configured correctly in the console, but not in PyCharm. You can check and compare their values, in the console do

echo $CUDA_HOME
echo $LD_LIBRARY_PATH

      

In PyCharm (say in your main script):

import os
print(os.environ.get('CUDA_HOME'))
print(os.environ.get('LD_LIBRARY_PATH'))

      



You can customize them for a given configuration Run Configuration in Environment Variables.

The best approach would be to set these environment variables globally, so every process on the system will have access to them. To do this, you need to edit the file /etc/environment

and add the original values ​​obtained from the console.

There are very similar problems here: one , two , three .

+1


source







All Articles