1
votes

I have an issues with tensorflow on pycharm.

Whenever I import tensorflow in the linux terminal, it works correctly. However, in PyCharm community 2017.1, it shows:

ImportError: libcudnn.so.5: cannot open shared object file: No such file or directory

Any hint on how to tackle the issue.

Please note that I am using python 3.5.2, tensorflow 1.1.0, Cuda 8 and CuDnn 5.1

EDIT: when printing sys.path, I get this in PyCharm:

['/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/home/xxx/pycharm-community-2017.1.2/helpers/pydev', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/xxx/xxx']

and this in the terminal: ['', '/usr/local/bin', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages', '/usr/local/lib/python3.5/dist-packages/IPython/extensions', '/home/xxx/.ipython']

1
Can you check whether sys.path's match when running via terminal vs. via PyCharm? - Mirac7
I just edited my question. - ryuzakinho
Can you try to add this code to the beginning of your script (before other imports) and run via PyCharm: import sys; sys.path.extend(["/usr/local/bin", "/home/xxx/.ipython"])? Is the problem still there? - Mirac7
@Mirac7 thanks but the issue is still there. - ryuzakinho

1 Answers

3
votes

The solution is:

  • Run PyCharm from the console. OR
  • add the environment variable to the IDE settings: LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH