Tensorflow on mac cpu first run gives an error - python

I've installed cpu version following page indications. And it gives me the following error when trying to run tensorflow:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/francisco/venv/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/francisco/venv/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/francisco/venv/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/francisco/venv/lib/python2.7/site-packages/tensorflow/python/../libtensorflow_framework.so
I tried to install from the wheel url
curl -O https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py2-none-any.whl
But it continues throwing the same error

Tensor flow is only supported by Python 3.5 and Python 3.6.
I highly recommending downloading a pre-compiled version from Anaconda here.

Related

Object detection API using Tensorflow

I am trying to run a code for object detection using Tensorflow.But I'm getting following error when I'm running it.Help me.
>protoc object_detection/protos/*.proto --python_out=.
>export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
>python object_detection/builders/model_builder_test.py
Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 20, in <module>
import tensorflow as tf
File "/home/dora/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/dora/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/dora/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/dora/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/dora/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/dora/.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: libcublas.so.10.0: cannot open shared object file: No such file or directory
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.
It's related to GPU libraries. Make sure you have installed CUDA 10.0 and followed all steps to install tensorflow-gpu
libcublas.so.10.0 file is missing in cuda folders. Please ensure the file is present in the installation folder and ensure it is in Path

Failed to load the native TensorFlow runtime - Symbol not found: _clock_gettime

Been having a ton of issues loading Tensorflow. I've uninstalled and reinstalled numpy (now it's up to date, that was another initial error), uninstalled and reinstalled Tensorflow, and uninstalled and reinstalled Nextgenrnn (the package I plan to use it in combination with).
Launching python and calling "import tensorflow", I receive this really long error message.
Here is a full stack trace:
Traceback (most recent call last):
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "//anaconda/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 "//anaconda/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "//anaconda/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(//anaconda/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "//anaconda/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "//anaconda/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 "//anaconda/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "//anaconda/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(//anaconda/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _clock_gettime
Referenced from: /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /anaconda/lib/python3.5/site-packages/tensorflow/python/../libtensorflow_framework.so
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.
I'm not sure how to proceed.
I have Python 3.5.6 installed from Anaconda, running on OS X El Capitan.
In the macOS SDK clock_gettime is declared like this: __CLOCK_AVAILABILITY
int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
and if we look at the definition of the __CLOCK_AVAILABILITY macro: #define __CLOCK_AVAILABILITY __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
We can see that clock_gettime was not added to the API until macOS 10.12. You are on El Capitan which is macOS 10.11. You need to update your OS, or downgrade your packages.

Tensorflow error while training model with RASA NLU

I am using RASA NLU. While training the bot I am getting the following exceptionL
a. ImportError: No module named '_pywrap_tensorflow_internal'
b. Failed to load the native TensorFlow runtime.
and quite a bit of errors in stack trace as one can see at the end of the post.
Here is snippet of versions I am using for different modules with python 3.6.8:
tensorboard 1.8.0
rasa-core 0.10.1
rasa-nlu 0.13.0a2
Keras 2.1.6
I ensured the training domain yaml is placed in right location and has no errors.
Stack Trace:
\ML-Python\RASA\Rasa_basic_folder>python ./train_init.py
F:\Anaconda-32bit\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "F:\Anaconda-32bit\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./train_init.py", line 19, in <module>
agent = Agent('./restaurant_domain.yml', policies = [MemoizationPolicy(max_history = 4), KerasPolicy(featurizer)])
File "c:\python27\scripts\rasa_core-master\rasa_core\policies\keras_policy.py", line 47, in __init__
if KerasPolicy.is_using_tensorflow() and not graph:
File "c:\python27\scripts\rasa_core-master\rasa_core\policies\keras_policy.py", line 64, in is_using_tensorflow
from keras.backend import _BACKEND
File "F:\Anaconda-32bit\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "F:\Anaconda-32bit\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "F:\Anaconda-32bit\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "F:\Anaconda-32bit\lib\site-packages\keras\backend\__init__.py", line 84, in <module>
from .tensorflow_backend import *
File "F:\Anaconda-32bit\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "F:\Anaconda-32bit\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "F:\Anaconda-32bit\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Seems like tensorflow is not correctly installed. Please try re-installing rasa-core with pip install -U rasa-core or even update to the new rasa package, which combines rasa-nlu and rasa-core (the old rasa-core and rasa-nlu are packages are deprecated). You can do so by doing pip install rasa.
For you to resolve these tensorflow dependencies - see below.
pip install rasa[convert]

How do I solve "Failed to load the native TensorFlow runtime"?

Failed to load the native TensorFlow runtime
I've downgraded from python version 3.7 to python 3.6.8 using windows 10.0, Tensorflow-gpu, cuda 9.0, cudnn 7.0.
Executed the command as shown in code below in order to train my data.
The error I got was: "Failed to load the native TensorFlow runtime".
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
I expected that "TensorFlow will initialize the training and that the training will begin".
Actual Results:
Traceback (most recent call last):
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\user\Anaconda3\envs\tensorflow1\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\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 343, in load_dynamic
return _load(spec)
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 "train.py", line 47, in <module>
import tensorflow as tf
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\user\Anaconda3\envs\tensorflow1\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\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\Anaconda3\envs\tensorflow1\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
You need to update cuDNN (>= 7.2).
Try to match the tensorflow version with the CUDA.
try updating tensorflow
try this := pip3 install --upgrade tensorflow
worked for me!

tensorflow import error: _pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type

I would like to do Streaming Accuracy and follow the instructions on Tensorflow Audio recognition official webpage. My environment is Ubuntu 16.04, Python 3.5, tensorflow 16.0 in virtualenv.
After I ran this command in a virtualenv environment,
bazel run tensorflow/examples/speech_commands:generate_streaming_test_wav
some error message came out. Please check this gist for more detail.
In brief,
Line 1~7: I would like to make sure that importing tensorflow is ok
Line 9~69: The error message shows that Failed to load the native TensorFlow runtime.
INFO: Running command line: bazel-bin/tensorflow/examples/speech_commands/generate_streaming_test_wav
Traceback (most recent call last):
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/jean_lin/py35_tf16/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/jean_lin/py35_tf16/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/examples/speech_commands/generate_streaming_test_wav.py", line 47, in <module>
import tensorflow as tf
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/jean_lin/py35_tf16/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/jean_lin/py35_tf16/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/jean_lin/.cache/bazel/_bazel_jean_lin/7ec2afa2cc3b112c8391a9677667186f/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/examples/speech_commands/generate_streaming_test_wav.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type
Failed to load the native TensorFlow runtime.
Line 72~93: I have no idea why it can't load the native tensorflow. I try to import tensorflow again. And found out that I can't import tensorflow correctly.
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "/home/jean_lin/kws/tensorflow/tensorflow/python/platform/self_check.py", line 25, in <module>
from tensorflow.python.platform import build_info
ImportError: cannot import name 'build_info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jean_lin/kws/tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/home/jean_lin/kws/tensorflow/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/jean_lin/kws/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 25, in <module>
from tensorflow.python.platform import self_check
File "/home/jean_lin/kws/tensorflow/tensorflow/python/platform/self_check.py", line 27, in <module>
raise ImportError("Could not import tensorflow. Do not import tensorflow "
ImportError: Could not import tensorflow. Do not import tensorflow from its source directory; change directoryto outside the TensorFlow source tree, and relaunch your Python interpreter from there.
Any advise would be very appreciate. Thank you.
About the last error:
ImportError: Could not import tensorflow. Do not import tensorflow from its source directory;
It means that you can't "import tensorflow" in the root of source code path(like:/tensorflow-2.2.0). You just find another path then "import tensorflow".
About the first error , I think I met a similair error, my solution is
pip uninstall tensorflow
rebuild tensorflow
re-pip install tensorflow.

Categories