System information
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): failed at import tensorflow
OS Platform and Distribution: lsb_release -a
TensorFlow installed from: Anaconda
TensorFlow version (use command below): 1.11.0
Python version: 3.6.6
Bazel version (if compiling from source): not using
GCC/Compiler version (if compiling from source): [GCC 7.3.0] on linux
CUDA/cuDNN version: 9.1.85 / not sure was automatically download
GPU model and memory: GeForce 840m
Describe the problem
Basically it doesn't work when i run "import tensorflow"
Source code / logs
Python 3.6.6 |Anaconda, Inc.| (default, Oct 9 2018, 12:34:16)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/herooooooooo/anaconda3/envs/tf_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/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/herooooooooo/anaconda3/envs/tf_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/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/herooooooooo/anaconda3/envs/tf_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/herooooooooo/anaconda3/envs/tf_gpu/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/herooooooooo/anaconda3/envs/tf_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.
Related
Hi I've been using Adrian's guide from https://www.pyimagesearch.com/2020/03/25/how-to-configure-your-nvidia-jetson-nano-for-computer-vision-and-deep-learning/
I'm attempting to run Tensorflow 1.13.1 on a Jetson Nano. When I go to initiate python and import tensorflow I get the following error:
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow
Traceback (most recent call last):
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/zachwad/.virtualenvs/py3cv4/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/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.10.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/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/init.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/zachwad/.virtualenvs/py3cv4/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/zachwad/.virtualenvs/py3cv4/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/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.10.0: cannot open shared object file: No such file or directory
Seems related to the following problem.
Make sure that a compatible cuda version (in this case cuda 10) is installed on your system and that the linker can find the library: libcublas.so.10.0
Tensorflow often uses older cuda versions.
Keep also in mind that tensorflow released version 2.0, which is very different from version 1.13.
I got this error with tensorflow and i can't find a way to resolve it.
I got :
Python 3.6.8
Tensorflow-gpu 1.13.1
Cuda 10.1
Cudnn 7.5.1
The error is as follows:
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "E:\projects\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\projects\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\projects\venv\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 "E:\projects\venv\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "E:\projects\venv\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Le module spécifié est introuvable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "E:\projects\venv\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "E:\projects\venv\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "E:\projects\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "E:\projects\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\projects\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\projects\venv\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 "E:\projects\venv\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "E:\projects\venv\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Le module spécifié est introuvable.
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've followed this installation guide : https://www.tensorflow.org/install/gpu
I've properly edit all paths like explained.
And i don't really understand how i can fix this error.
Thanks.
TF 1.13 comes with cuda 10.0 pre-built binaries. Please download cuda 10.0 toolkit and update cuda, cudnn paths. https://www.tensorflow.org/install/gpu#software_requirements
By default Nvidia hosts the latest cuda release (currently it has 10.1) which may not be present in latest stable TF binary. You can select cuda 10.0 from this link https://developer.nvidia.com/cuda-toolkit-archive.
I wanted to get started using tensorflow.
i downloaded tensorflow-1.12.0-cp37-cp37m-win_amd64.whl and installed it via pip which worked.
but when i want to run the tensorflow tutorialcode it throws the following error:
Traceback (most recent call last):
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\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\johnson\AppData\Local\Programs\Python\Python37\lib\imp.py", > line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\johnson\AppData\Local\Programs\Python\Python37\lib\imp.py", > line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/johnson/PycharmProjects/Data
exploration/MNISTTensorflow.py", line 4, in
import tensorflow as tf
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-packages\tensorflow__init__.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint:
disable=unused-import
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-packages\tensorflow\python__init__.py", line 49,
in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\johnson\PycharmProjects\Data exploration\Data
exploration\venv\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\johnson\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\johnson\AppData\Local\Programs\Python\Python37\lib\imp.py",
line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
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.
Process finished with exit code 1
i tried downloading and installing the 1.12.0 version. but when i want to add the package to the interpreter (via "settings" in pycharm), only the 1.13.1 version showed up (which was already uninstalled). that just adds to my confusion. as you surely can see, im new to python. i hope my questions are not too stupid. thank you!
i use:
- windos 7 (64bit)
- Python 3.7
- PyCharm community edition 2018.3.2
- GeForce GT 425m
- i5 CPU M580
I am able to import tensorflow using python 2.7. But I am getting the following error while trying to import tensorflow using python 3.6.4:
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/root/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 "/root/anaconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/root/anaconda3/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
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/root/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/root/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 "/root/anaconda3/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/root/anaconda3/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.
I have cuda 9.1 and tensorflow 1.6 installed in my system.
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
It seems your Tensorflow version for Python 3.6.x has been compiled for CUDA 9.0, not 9.1.
So far for CUDA 9.1, you may have to build Tensorflow from source yourself (Github discussion, install doc).
I built TensorFlow from source on Raspbian Stretch. I encountered a problem though when starting up TensorFlow. I get an ImportError as shown below:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "idex.py", line 1, in
import gui
File "/home/pi/Desktop/IDEX/scripts/gui.py", line 10, in
import fun_util
File "signlang/fun_util.py", line 3, in
import tensorflow as tf
File "/usr/local/lib/python3.5/dist-packages/tensorflow/init.py", line 24, in
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/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.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZN10tensorflow9ConcatCPUINS_8bfloat16EEEvPNS_10DeviceBaseERKSt6vectorISt10unique_ptrINS_6TTypesIT_Li2EiE11ConstMatrixESt14default_deleteIS9_EESaISC_EEPNS8_6MatrixE
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've tried searching for this problem but I couldnt find anything for this particular undefined symbol.
I was able to install TF with Keras using pip3 on Raspbian Stretch. It is much faster then building it.
Here what I run following https://installvirtual.com/how-to-install-tensorflow-on-raspberry-pi/ :
sudo apt update
sudo apt install python3-dev python3-pip
sudo apt install libatlas-base-dev
sudo pip3 install -U virtualenv
pip3 install tensorflow
sudo pip3 install keras