Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError #1

Open
MitrandirToPP opened this issue Nov 3, 2017 · 3 comments
Open

ImportError #1

MitrandirToPP opened this issue Nov 3, 2017 · 3 comments

Comments

@MitrandirToPP
Copy link

MitrandirToPP commented Nov 3, 2017

Got error in jupyter notebook script during the work within docker image, in the very beginning of the script:

import keras
import tensorflow as tf
print('TensorFlow version:', tf.version)
print('Keras version:', keras.version)

Using TensorFlow backend.

ImportError Traceback (most recent call last)
/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py in ()
57
---> 58from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import version

/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in ()
27 return _mod
---> 28_pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper

/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:

/opt/conda/lib/python3.5/imp.py in load_module(name, file, filename, details)
242 else:
--> 243return load_dynamic(name, filename, file)
244 elif type_ == PKG_DIRECTORY:

/opt/conda/lib/python3.5/imp.py in load_dynamic(name, path, file)
342 name=name, loader=loader, origin=path)
--> 343return _load(spec)
344

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

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in ()
----> 1import keras
2 import tensorflow as tf
3 print('TensorFlow version:', tf.version)
4 print('Keras version:', keras.version)

/src/keras/init.py in ()
1 from future import absolute_import
2
----> 3from . import utils
4 from . import activations
5 from . import applications

/src/keras/utils/init.py in ()
4 from . import data_utils
5 from . import io_utils
----> 6from . import conv_utils
7
8 # Globally-importable utils.

/src/keras/utils/conv_utils.py in ()
1 from six.moves import range
2 import numpy as np
----> 3from .. import backend as K
4
5

/src/keras/backend/init.py in ()
81 elif _BACKEND == 'tensorflow':
82 sys.stderr.write('Using TensorFlow backend.\n')
---> 83from .tensorflow_backend import *
84 else:
85 raise ValueError('Unknown backend: ' + str(_BACKEND))

/src/keras/backend/tensorflow_backend.py in ()
----> 1import tensorflow as tf
2 from tensorflow.python.client import device_lib
3 from tensorflow.python.training import moving_averages
4 from tensorflow.python.ops import tensor_array_ops
5 from tensorflow.python.ops import control_flow_ops

/opt/conda/lib/python3.5/site-packages/tensorflow/init.py in ()
22
23 # pylint: disable=wildcard-import
---> 24from tensorflow.python import *
25 # pylint: enable=wildcard-import
26

/opt/conda/lib/python3.5/site-packages/tensorflow/python/init.py in ()
47 import numpy as np
48
---> 49from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers

/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py in ()
70 for some common reasons and solutions. Include the entire stack trace
71 above this error message when asking for help.""" % traceback.format_exc()
---> 72raise ImportError(msg)
73
74 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/opt/conda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/opt/conda/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/opt/conda/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcudnn.so.6: 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.

What have I done wrong?

@mkolomeychenko
Copy link
Contributor

Do you have cuda libraries installed on your host? What is the version?

@Skywalker666666
Copy link

Hi, I got similiar problem with this. which feedback to me as:


ImportError Traceback (most recent call last)
in ()
2 get_ipython().magic('matplotlib inline')
3 import numpy as np
----> 4 import cv2
5 from os.path import join
6 import os

/usr/local/lib/python3.5/dist-packages/cv2/init.py in ()
7
8 # make IDE's (PyCharm) autocompletion happy
----> 9 from .cv2 import *
10
11 # wildcard import above does not import "private" variables like version

ImportError: libSM.so.6: cannot open shared object file: No such file or directory

In [ ]:

@Qirui-Y
Copy link

Qirui-Y commented Mar 16, 2019

I had a similar problem before, maybe a version compatibility issue, re-created the virtual environment and don't install the tensorflow-gpu version if your computer performance is not good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants