System Information
MacBook Air M1
Ubuntu Linux 20.04 using virtual machine
Python 3.8.5 64 bits
I have already installed tensor flow but after importing the library and compiling any code it gives me the following set of error
Traceback (most recent call last):
File "/home/mradulagrawal/Desktop/IP/image.py", line 2, in <module>
import tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
mradulagrawal@ubuntu:~/Desktop$ /usr/bin/python3 /home/mradulagrawal/Desktop/IP/image.py
Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mradulagrawal/Desktop/IP/image.py", line 2, in <module>
import tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Thank You!
According to the information you provided, the problem occurred in the relevant files of the installed module "tensorflow".
It is recommended that you find the installation package folder of the module "tensorflow" in this python environment and try to delete it, then reinstall it to avoid damage or incompatibility of some files.
We can use " pip show module
" to find the installation location of the module:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.