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
Related
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.
To run our tests on Jenkins, we need to install tensorflow in the virtual environment inside the Jenkins agent. I am getting the following error.
import tensorflow as tf
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/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: /prod/msp/build/slave1/workspace/Jobs_uiuc_simplesilo_master-7ENH27JSQENY42PFYNEOG3SJGXLTHWJC5Z6KNZUHEDUIGUWU5ZHQ/venv2/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyUnicodeUCS4_FromString
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.
From the last line of error PyUnicodeUCS4_FromString I think this might be because of the wrong UCS type in python. However, I do not have sudo control over the Jenkins agents to install another python version. Any suggestions?
TF version : 1.6.0
Python verson: 2.7.3
I tried running tensorflow inside a Docker image on Jenkins and it worked.
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.
I installed tensorflow on my mac via pip and I'm using anaconda as my IDE.
when I run the command
import tensoflow
I'm getting the following error:
Traceback (most recent call last):
File "<ipython-input-3-a649b509054f>", line 1, in <module>
import tensorflow
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Applications/anaconda3/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 "/Applications/anaconda3/lib/python3.5/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Applications/anaconda3/lib/python3.5/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: #rpath/libcublas.8.0.dylib
Referenced from: /Applications/anaconda3/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Reason: image not found
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.
I also ran pip list in my terminal to check if it was installed properly.
It lists all the tensorflow libraries that I have installed.
I'm using Anaconda v1.6.8 and Spyder v3.2.3
I can see that you have 2 versions of tensorflow. with (1.1.0) and without (1.3.0) gpu support. But error you are getting is because the gpu libraries are not properly installed.
For tensorflow-gpu==1.1.0 follow these instructions.
Unfortunatelly tensorflow dropped support for gpu on Mac since v1.2, but this answer may help you setup for a higher version.
[xx_xx#xxxx ~]$ python multiply.py
Traceback (most recent call last):
File "multiply.py", line 2, in <module>
import tensorflow as tf
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 22, in <module>
from tensorflow.python.client.client_lib import *
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/python/client/client_lib.py", line 35, in <module>
from tensorflow.python.client.session import InteractiveSession
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 11, in <module>
from tensorflow.python import pywrap_tensorflow as tf_session
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/luohao/.usr/bin/python2.7.10/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory
When I execute python command, a "ImportError" error occurs.Some solved it by adding "export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib:/usr/local/cuda-5.5/lib64" in the /etc/profile.I try it but do no effect.I find the "libcudart.so.7.0" in /usr/share/man/man7/libcudart.so.7 by executing the whereis command and have no idea what should I do next to solve it.
This error is being raised because the loader cannot find version 7.0 of the CUDA runtime on your system. TensorFlow requires CUDA 7.0.
From the path in your question (/usr/local/cuda-5.5/...) it looks like you have CUDA 5.5 installed. The solution is to upgrade your CUDA runtime to version 7.0, which is available from NVIDIA here.