Dipendra Singh
Dipendra Singh

Reputation: 3

Tensorflow installation using pip, import not happening

I installed tensorflow using pip, and it shows success but when I import tensorflow the following error comes.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)  
ImportError: Traceback (most recent call last):
  File "/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/Users/dipendra/.local/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: dlopen(/Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: @rpath/libcublas.8.0.dylib
  Referenced from: /Users/dipendra/.local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
  Reason: image not found 
Failed to load the native TensorFlow runtime.

Upvotes: 0

Views: 85

Answers (1)

KimKulling
KimKulling

Reputation: 2833

Tensorflow tries to load the following dependency:

libcublas

To fix this follow these steps:

  • Make sure that cuda for python is installed ( via pip )
  • Make sure that the code lib installation path was added to your env-var LD_LIBRARY_PATH

You can check the following question to see how to do so: Cannot find cuda

Upvotes: 1

Related Questions