简体   繁体   中英

Problems with installing tensorf flow on ubuntu

I installed tensorflow on Linux, but when I try to import it in the python shell it cannot find the module. I cannot find the error massage on the tensorflow website. Does anyone have any ideas on how I can fix it?

Whenever I give the command:

import tensorflow as tf

I get as a return:

Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/beheerder/anaconda2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

Going through your error seems like you're using anaconda for your tensorflow. I have got this error and it seems that tensorflow-gpu for anacoda is still under development and does not work properly.

I suggest you to installed the tensorflow-gpu version out of the anaconda environment. The cpu version works fine though.

After clean installing it again without anacoda for python 2.7. DO:

cd /opt/DL/tensorflow/bin/
source tensorflow-activate

Follow this as it is similar

It looks like it can't find your Cuda library. Things you want to check are:

  • Do you actually have a GPU? If not: reinstall the non-GPU tensorflow
  • Do you have Cuda version 8.0? Before you could use an older version, but since the Tensorflow 1.0 release you have to have at least version 8. Maybe reinstall Cuda to fix this problem.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM