3

I was working with the tensorflow(GPU version) module in Pycharm. If I run a script from 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

Pycharm interpreter shows tensorflow as a package.

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

1 Answer 1

2

Looks like your CUDA_HOME or LD_LIBRARY_PATH configured correctly in the console, but not in PyCharm. You can check and compare their values, in 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 configure them for the given Run Configuration in Environment Variables section.

Better approach would be configuring those environment variables globally, so every process in the system would have an access to them. To do that you have to edit /etc/environment file and add original values, which you got from console.

Here are very similar problems: one, two, three.

Sign up to request clarification or add additional context in comments.

7 Comments

Running in terminal gives me 1) /usr/local/cuda ,2)/usr/local/cuda/lib64 Running in pycharm gives 1) None ,2)/home/raghav/Downloads/pycharm-community-2017.1.3/bin: . Could you please guide me
@rjmessibarca, what OS do you use?
I use ubuntu 16 @grundic
Then you can set environment variables in .bashrc file as describe here. Or you can configure them in PyCharm Run Configuration: Run -> Edit Configurations... -> Environment Variables and set same values as you got from console.
I was able to add using Run > Edit Configurations ... How do I add for all the python files? Also does the output of LD_LIBRARY_Path also need to be same?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.