I am using PyCharm 5 to run a Python 2.7 (Anaconda) script in Ubuntu. My script imports a module with import tensorflow
, but this causes the error ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory
. So, it seems that the library libcudart.so.7.0
is needed by this module, but it cannot be found.
Now, I have seen that this library is on my machine in /usr/local/cuda-7.0/targets/x86_64-linux/lib
. So, in PyCharm, I went to Settings->Project Interpreters->Interpreter Paths
. This had a list of paths, such as /home/karnivaurus/Libraries/Anaconda/python2.7
. I then added to this list, the path mentioned above which contains the required library.
However, this did not fix the problem. I still get an error telling me that libcudart.so.7.0
cannot be found. If I run my script from the shell though (python myfile.py
), then it runs fine.
How can I tell PyCharm where to find this library?
I have noticed that if I have print sys.path
in my script, the paths it prints out are entirely different to those in Settings->Project Interpreters->Interpreter Paths
... should they be the same?
Expand the list of the available versions in the upper-right corner of the tool window. Select the required version or keep it the latest. Click the Install button next to the version list. Once PyCharm notifies you about successful installation, you should see the package in the list of the installed packages.
Try installing/importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment. In case you are using a virtualenv/conda environment as your Project Interpreter in PyCharm, it is enough to activate that environment in the system terminal and then do the test.
Pycharm supports installation, uninstallation, and up-gradation of Python packages. By default, Pycharm makes use of the pip package manager for the same.
I came across this problem just recently using a remote debugger, however I believe it's still the same solution. I just added the following to the Environment Variables section in the Run/Debug Configuration options found in Run > Edit Configurations... dialog: LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With