1
votes

I've installed Tensorflow within a virtual environment on my machine. It works from the command line but when I try to run it from Pycharm it gives the following error: Pycharm Console Output

The project interpreter is set to virtualenv at ~/tensorflow and for the interpreter paths the following ones are set:

  • /home/user/tensorflow/lib/python3.5
  • /home/user/tensorflow/lib/python3.5/plat-x86_64-linux-gpu
  • /home/user/tensorflow/lib/python3.5/lib-dynload
  • /usr/lib/python3.5
  • /usr/lib/python3.5/plat-x86_64-linux-gnu
  • /home/user/tensorflow/lib/python3.5/site-packages
  • /usr/lib/python3.5/site-packages
  • /usr/local/lib/python3.5/dist-packages
  • /usr/lib/python3/dist-packages

The code (from a tutorial) I've tried to run is the following:

    import tensorflow as tf

    x = tf.constant(35, name='x')
    y = tf.Variable(x + 5, name='y')

    model = tf.global_variables_initializer()

    with tf.Session() as session:
    session.run(model)
    print(session.run(y))

So what could this error be related to?

1
Do you install CUDA and cudnn? or do you set cuda path, example?xxi
yes, the LD_LIBRARY_PATH and CUDA_HOME variables are set. As mentioned, the above code does work if I call it with the activated virtenv from the command line.Smyke
Do you think this possible? I set the path at etc/profilexxi
Thanks, the issue seems related, but how can I make it so, that Pycharm gets access to the libcudart.so.8.0 file?Smyke
sorry, I'm not familiar this. But I think check path is a good start. Since you are using pycharm, I think you can use echo $0 to check which bash is using. Then check cuda path, if not exist, add it. e.g. you add path at bash but you are using zshxxi

1 Answers

0
votes

Ok, so it works if you call Pycharm from the terminal. I guess that the terminal context is given to pycharm the moment you load it from the command line. (Pycharm is executed from the command line by executing the pycharm.sh script. If you don't know how where it is then type 'locate pycharm.sh')