TensorFlow issues with running with Python 3.6 - python

so trying to use TF to run through terminal to train images but receive this similar error. I know it's because TensorFLow is currently formatted to run with Python 3.5 and not 3.6 at this time.
Possible solutions, should I delete Python 3.6 and reinstall 3.5 with Anaconda?
Traceback (most recent call last):
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/Mari/miniconda3/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 "/Users/Mari/miniconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Users/Mari/miniconda3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: #rpath/libcublas.8.0.dylib
Referenced from: /Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Reason: image not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/Mari/miniconda3/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 "/Users/Mari/miniconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/Users/Mari/miniconda3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: dlopen(/Users/Mari/miniconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 10): Library not loaded: #rpath/libcublas.8.0.dylib
Referenced from: /Users/Mari/miniconda3/lib/python3.6/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

It says Reason: image not found in your code. Are you sure that you are just not having a wrong file path to your image? Did you try to just run import tensorflow as tf and sess = tf.Session() to see if Tensorflow initializes correctly?
Please also always add which system you are running. In general I would recommend to create a virtual environment with a specific python version set, to run tensorflow in. See here:
https://conda.io/docs/user-guide/tasks/manage-environments.html

Related

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.

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!

python Tensorflow ImportError

Please help me with this error:
import tensorflow as tf Traceback (most recent call last): File
"/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 41, in
from tensorflow.python.pywrap_tensorflow_internal import * File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28, in
_pywrap_tensorflow_internal = swig_import_helper() File "/home/user/anaconda3/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
"/home/user/anaconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file) File "/home/user/anaconda3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec) ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 1, in
File
"/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/init.py",
line 24, in
from tensorflow.python import * File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/init.py",
line 49, in
from tensorflow.python import pywrap_tensorflow File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 52, in
raise ImportError(msg) ImportError: Traceback (most recent call last): File
"/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py",
line 41, in
from tensorflow.python.pywrap_tensorflow_internal import * File "/home/user/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28, in
_pywrap_tensorflow_internal = swig_import_helper() File "/home/user/anaconda3/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
"/home/user/anaconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file) File "/home/user/anaconda3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec) ImportError: libcusolver.so.8.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.
You could try that:
Confirm the python interpreter path, is anaconda or system python?
export python library export PYTHONPATH=xxxxx:$PYTHONPATH to solve some lib couldn't find before execute a python script in terminal.
If you following two step, above troubles could be solved.
Before importing TensorFlow, you need to install TensorFlow on Python 3.6.
Firstly, I assumed that you use the Windows operating system because you did not explain any information about your computer.
Open the Anaconda prompt, install TensorFlow with this command:
pip install tensorflow==2.0
If everything installs successfully, you can import the TensorFlow library in Python.
import tensorflow as tf

How to import tensorflow in python CGI program on CentOS server

I can't import tensorflow in my python CGI program on my server.
I have a VPS with CentOS6.9 operation system. I already installed gcc-4.9.0 and python3.6 so I can run python script which import tensorflow and keras.
Now I want to write a python CGI program which also import tensorflow and keras. But as soon as I add "import tensorflow as tf" my script returns a server 500 error. After removing this line of code my script runs fine. The same situation goes for keras module as well.
I googled some. It seems to be related to apache enviroment values maybe it still use gcc-4.4.7 although I already linked usr/bin/gcc to my latest gcc-4.9.0. But there are not exlaborate answer to this.
The error log on apache shows:
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/python3/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 "/usr/local/python3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/local/python3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.7' not found (required by /usr/local/python3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 8, in <module>
import tensorflow as tf
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/python3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/python3/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 "/usr/local/python3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/local/python3/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.7' not found (required by /usr/local/python3/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.
I got this error before when running the script as python script through SSH. After updating gcc on my server and change the link under 'usr/bin/gcc' I already fix it when running as python script. But somehow the apache configuration still use the old gcc. So I don't know how to configure it.

Tensorflow Gpu import error(installed in Anaconda with high level API)

I installed anaconda3 in my ubuntu AWS case.
I finishe the creation of the environment:
conda create -n tensorflow-gpu
I used the high level command
conda install tensorflow-gpu
This works on my own computer but not on AWS.
It installed all relavent packages and didn't yield any errors.
But when I import tensorflow,
it gives me the error:
Traceback (most recent call last):
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/ubuntu/.conda/envs/tensorflow-gpu/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 "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/ubuntu/.conda/envs/tensorflow-gpu/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 "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/ubuntu/.conda/envs/tensorflow-gpu/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcuda.so.1: 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.
This is beyond my abilities to understand since it worked well in my own computer.
I also tried suggestions on:
tensorflow import error in anaconda
It doesn't work as well.

Categories