I am attempting to install tensorflow 1.8 to 1.10.1. Unfortunately, I installed it with both pip and conda, and while it worked when I tried to upgrade to tensorflow 1.10.1 I get the below error message. I have attempted to remove it with both pip and conda as well as create a new conda environment and install it fresh in conda. With no other versions of tensorflow installed (for any other conda env as well) I ran:
conda create -n testing python=3.6.5 scipy numpy jupyter scikit-learn matplotlib seaborn nltk tensorflow
Then when I import tensorflow I get the same error message:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import __version__
/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in <module>()
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper
/anaconda3/envs/testing/lib/python3.6/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:
/anaconda3/envs/testing/lib/python3.6/imp.py in load_module(name, file, filename, details)
242 else:
--> 243 return load_dynamic(name, filename, file)
244 elif type_ == PKG_DIRECTORY:
/anaconda3/envs/testing/lib/python3.6/imp.py in load_dynamic(name, path, file)
342 name=name, loader=loader, origin=path)
--> 343 return _load(spec)
344
ImportError: dlopen(/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: __ZN10tensorflow10DeviceBase16eigen_cpu_deviceEv
Referenced from: /anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Expected in: /Users/avanders/tensorflow_libs/lib/libtensorflow_framework.so
in /anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-2-64156d691fe5> in <module>()
----> 1 import tensorflow as tf
/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/__init__.py in <module>()
20
21 # pylint: disable=g-bad-import-order
---> 22 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
23
24 try:
/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/anaconda3/envs/testing/lib/python3.6/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 "/anaconda3/envs/testing/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/anaconda3/envs/testing/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: __ZN10tensorflow10DeviceBase16eigen_cpu_deviceEv
Referenced from: /anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Expected in: /Users/avanders/tensorflow_libs/lib/libtensorflow_framework.so
in /anaconda3/envs/testing/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
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.
So it turns out the problem was a conflict in versions with the go wrappers I had installed for the tensorflow library. Once I updated those wrappers to the same version a conda install worked.
Related
OSError Traceback (most recent call last)
<ipython-input-2-7dd3504c366f> in <module>
----> 1 import pandas as pd
~\AppData\Roaming\Python\Python38\site-packages\pandas\__init__.py in <module>
9 for dependency in hard_dependencies:
10 try:
---> 11 __import__(dependency)
12 except ImportError as e:
13 missing_dependencies.append(f"{dependency}: {e}")
~\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py in <module>
136
137 # Allow distributors to run custom init code
--> 138 from . import _distributor_init
139
140 from . import core
~\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py in <module>
24 # NOTE: would it change behavior to load ALL
25 # DLLs at this path vs. the name restriction?
---> 26 WinDLL(os.path.abspath(filename))
27 DLL_filenames.append(filename)
28 if len(DLL_filenames) > 1:
~\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error,
winmode)
379
380 if handle is None:
--> 381 self._handle = _dlopen(self._name, mode)
382 else:
383 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
I tried to "import pandas as pd" and this is the output in the jupyter notebook. what does the traceback(most recent call last) mean? Also why are there arrows pointing at specific lines?
Here below the error showing up after trying to run, the error does not persist if rolling back top Tensorflow 2.0 version.
When autocompleting in Jupyter Notebook all sections are showing up normally, just fails to load.
Any possible workaround to avoid rolling back to older version?
In:
from tensorflow.keras.models import Sequential
Out:
ImportError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper
~\Anaconda3\lib\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:
~\Anaconda3\lib\imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:
~\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-4-f05745da3b73> in <module>
----> 1 from tensorflow.keras.models import Sequential
~\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43
~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
48 import numpy as np
49
---> 50 from tensorflow.python import pywrap_tensorflow
51
52 # Protocol buffers
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
67 for some common reasons and solutions. Include the entire stack trace
68 above this error message when asking for help.""" % traceback.format_exc()
---> 69 raise ImportError(msg)
70
71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\Michele\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Michele\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Michele\Anaconda3\lib\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 "C:\Users\Michele\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Michele\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
you can do these examples of the sequential model in TensorFlow Keras.you can also add layers according to your case.
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras import Sequential
model = Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add an output layer with 10 output units:
model.add(layers.Dense(10))
or
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = tf.keras.Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(layers.Dense(64, activation='relu'))
# Add another:
model.add(layers.Dense(64, activation='relu'))
# Add an output layer with 10 output units:
model.add(layers.Dense(10))
As of the latest TensorFlow version >= 2.2.0, the developers have modified the way (made it easier) to load the models/layers etc.
Therefore, the Sequential class is not longer in the package tensorflow.keras.models but in tensorflow.keras
I am using Python with anaconda distribution for converting a satellite image to array for further processing.But while using .ReadAsArray() function the below error is occurring.I have tried to search about the error but no proper results are coming.I have installed everything using conda command.
from osgeo import gdal
ds = gdal.Open('/home/alay/Desktop/Studies/2010/ndvi01jun2010.tif')
band = ds.GetRasterBand(1)
img= band.ReadAsArray()
The error occuring after executing the above code
ImportError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in
swig_import_helper()
17 try:
---> 18 fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
19 except ImportError:
~/anaconda3/lib/python3.6/imp.py in find_module(name, path)
296 else:
--> 297 raise ImportError(_ERR_MSG.format(name), name=name)
298
ImportError: No module named '_gdal_array'
During handling of the above exception, another exception occurred:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-eae4e7981f3a> in <module>()
----> 1 img= band.ReadAsArray()
~/.local/lib/python3.6/site-packages/osgeo/gdal.py in ReadAsArray(self, xoff, yoff, win_xsize, win_ysize, buf_xsize, buf_ysize, buf_type, buf_obj, resample_alg, callback, callback_data)
2603 parameters should generally not be specified if buf_obj is specified. The array is returned"""
2604
-> 2605 from . import gdalnumeric
2606
2607 return gdalnumeric.BandReadAsArray( self, xoff, yoff,
~/.local/lib/python3.6/site-packages/osgeo/gdalnumeric.py in <module>()
----> 1 from osgeo.gdal_array import *
2 from numpy import *
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in <module>()
26 fp.close()
27 return _mod
---> 28 _gdal_array = swig_import_helper()
29 del swig_import_helper
30 else:
~/.local/lib/python3.6/site-packages/osgeo/gdal_array.py in swig_import_helper()
18 fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
19 except ImportError:
---> 20 import _gdal_array
21 return _gdal_array
22 if fp is not None:
ModuleNotFoundError: No module named '_gdal_array'
I'm trying to use Google's Colaboratory. The first line of output was hopeful.
Using TensorFlow backend.
But then I got this error message.
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
That error apparently triggered another error. (Sorry for the long stack trace, but the error message itself suggested including it when asking for help.)
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-6-0b846698ae4a> in <module>()
2 import numpy as np
3 import matplotlib.pylab as plt
----> 4 from keras.models import Sequential
5 from keras.layers import Dense, InputLayer
6
/usr/local/lib/python3.6/dist-packages/keras/__init__.py in <module>()
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
/usr/local/lib/python3.6/dist-packages/keras/utils/__init__.py in <module>()
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.
/usr/local/lib/python3.6/dist-packages/keras/utils/conv_utils.py in <module>()
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
/usr/local/lib/python3.6/dist-packages/keras/backend/__init__.py in <module>()
82 elif _BACKEND == 'tensorflow':
83 sys.stderr.write('Using TensorFlow backend.\n')
---> 84 from .tensorflow_backend import *
85 else:
86 raise ValueError('Unknown backend: ' + str(_BACKEND))
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in <module>()
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.training import moving_averages
7 from tensorflow.python.ops import tensor_array_ops
/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py in <module>()
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25 # pylint: disable=wildcard-import
26 from tensorflow.tools.api.generator.api import * # pylint: disable=redefined-builtin
/usr/local/lib/python3.6/dist-packages/tensorflow/python/__init__.py in <module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
72 for some common reasons and solutions. Include the entire stack trace
73 above this error message when asking for help.""" % traceback.format_exc()
---> 74 raise ImportError(msg)
75
76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.9.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.
Below that was a suggestion to consult https://www.tensorflow.org/install/install_sources#common_installation_problems.
But that page is about installing TensorFlow from source. I'm not trying to install from source. I just want a runnable version that I can call.
Any suggestions would be appreciated.
Thanks.
I am trying a to import tensorflow in jupyter but I get this error--
ImportError Traceback (most recent call
last)
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py in swig_import_helper()
17 try:
---> 18 return importlib.import_module(mname)
19 except ImportError:
C:\Users\Dell\Anaconda3\lib\importlib\__init__.py in import_module(name,
package)
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
127
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name,
package, level)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in
_find_and_load(name, import_)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in
_find_and_load_unlocked(name, import_)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in
_load_unlocked(spec)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in
module_from_spec(spec)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap_external.py in
create_module(self, spec)
C:\Users\Dell\Anaconda3\lib\importlib\_bootstrap.py in
_call_with_frames_removed(f, *args, **kwds)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
ModuleNotFoundError Traceback (most recent call
last)
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py in <module>()
40 sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL)
---> 41 from tensorflow.python.pywrap_tensorflow_internal import *
42 from tensorflow.python.pywrap_tensorflow_internal import
__version__
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py in <module>()
20 return
importlib.import_module('_pywrap_tensorflow_internal')
---> 21 _pywrap_tensorflow_internal = swig_import_helper()
22 del swig_import_helper
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py in swig_import_helper()
19 except ImportError:
importlib.import_module('_pywrap_tensorflow_internal')
21 _pywrap_tensorflow_internal = swig_import_helper()
C:\Users\Dell\Anaconda3\lib\importlib\__init__.py in import_module(name,
package)
125 level += 1
127
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call
last)
<ipython-input-1-41389fad42b5> in <module>()
----> 1 import tensorflow as tf
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\__init__.py in
<module>()
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
25 # pylint: enable=wildcard-import
26
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python\__init__.py
in
<module>()
47 import numpy as np
48
---> 49 from tensorflow.python import pywrap_tensorflow
50
51 # Protocol buffers
C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py in <module>()
50 for some common reasons and solutions. Include the entire stack
trace
51 above this error message when asking for help.""" %
traceback.format_exc()
---> 52 raise ImportError(msg)
53
54 # pylint: enable=wildcard-import,g-import-not-at-top,unused-
import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Dell\Anaconda3\lib\importlib\__init__.py", line 126, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
File "<frozen importlib._bootstrap>", line 560, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 205, in
_call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Dell\Anaconda3\lib\site-packages\tensorflow\python
\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Dell\Anaconda3\lib\importlib\__init__.py", line 126, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
I try to install jupyter notebook within virtual tensorflow environment using pip without uninstalling the previous one.But error still exists.
I came to that jupyter should be installed under virtual environment.
I also cannot uninstall the previously installed jupyter.
Thanks in advance
I cannot figure out your problem, but I can suggest you a workaround. First install docker community edition, if you don't already have it. Just follow the instruction at:
https://docs.docker.com/install/
Then, once installed, open Kitematic, it will appear right-clicking the docker symbol. Once it starts, click on "new" and in the search box type "tensorflow-notebook" and then click "create". It will take some moment to fire up but it is a fantastic way of experiencing TF on Jupyter. Be careful though that by definition a Docker is stateless! So take care to configure under Settings/Volumes associated with the TF Docker in Kitematic, a Local Folder where to save all the stuff you want to save.