Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load the native TensorFlow runtime. #42186

Closed
Tech-Abdullahi opened this issue Aug 10, 2020 · 5 comments
Closed

Failed to load the native TensorFlow runtime. #42186

Tech-Abdullahi opened this issue Aug 10, 2020 · 5 comments
Assignees
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 type:build/install Build and install issues

Comments

@Tech-Abdullahi
Copy link

System information

  • OS Platform and Distribution windows 10
  • TensorFlow installed from source
  • TensorFlow 2.3
  • Python 3.8
  • Installed using conda

Describe the problem

I am just trying to a run a code that i downloaded from github if someone can help this is my first time using tensorflow.

Any other info / logs
[Running] python -u "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\MNIST\HelloTensor.py"
Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\MNIST\HelloTensor.py", line 1, in
import tensorflow as tf
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python_init
.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

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.

[Done] exited with code=1 in 145.607 seconds

[Running] python -u "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\EmotionDetection\EmotionDetector.py"
Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\EmotionDetection\EmotionDetector.py", line 1, in
import tensorflow as tf
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python_init
.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

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.

[Done] exited with code=1 in 366.04 seconds

[Running] python -u "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\EmotionDetection\EmotionDetector.py"
Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\projects\Desktop\Machine and Deep learning\TensorflowProjects-master\TensorflowProjects-master\EmotionDetection\EmotionDetector.py", line 1, in
import tensorflow as tf
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python_init
.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\projects.conda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\projects.conda\envs\tensorflow\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\projects.conda\envs\tensorflow\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\projects.conda\envs\tensorflow\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

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.

[Done] exited with code=1 in 196.316 seconds

@Tech-Abdullahi Tech-Abdullahi added the type:build/install Build and install issues label Aug 10, 2020
@google-ml-butler
Copy link

From the template it looks like you are installing TensorFlow (TF) prebuilt binaries:

  • For TF-GPU - See point 1
  • For TF-CPU - See point 2

1. Installing TensorFlow-GPU (TF) prebuilt binaries

Make sure you are using compatible TF and CUDA versions. Please refer following TF version and CUDA version compatibility table.

TF CUDA
2.1.0 - 2.2.0 10.1
1.13.1 - 2.0 10.0
1.5.0 - 1.12.0 9.0
  • If you have above configuration and using Windows platform -
    • Try adding the CUDA, CUPTI, and cuDNN installation directories to the %PATH% environment variable.
    • Refer windows setup guide.
  • If you have above configuration and using Ubuntu/Linux platform -
    • Try adding the CUDA, CUPTI, and cuDNN installation directories to the $LD_LIBRARY_PATH environment variable.
    • Refer linux setup guide.
  • If error still persists then, apparently your CPU model does not support AVX instruction sets.

2. Installing TensorFlow (TF) CPU prebuilt binaries

TensorFlow release binaries version 1.6 and higher are prebuilt with AVX instruction sets.

Therefore on any CPU that does not have these instruction sets, either CPU or GPU version of TF will fail to load.
Apparently, your CPU model does not support AVX instruction sets. You can still use TensorFlow with the alternatives given below:

  • Try Google Colab to use TensorFlow.
    • The easiest way to use TF will be to switch to google colab. You get pre-installed latest stable TF version. Also you can use pip install to install any other preferred TF version.
    • It has an added advantage since you can you easily switch to different hardware accelerators (cpu, gpu, tpu) as per the task.
    • All you need is a good internet connection and you are all set.
  • Try to build TF from sources by changing CPU optimization flags.

Please let us know if this helps.

@ravikyram ravikyram added subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 labels Aug 10, 2020
@ravikyram
Copy link
Contributor

@Abdallah-isa

What is make/model of your cpu?
I suspect your cpu model does not support AVX instructions sets.See hardware requirements
Make sure to download the latest microsoft visual c++ redistributable from here.
.Also, please follow the instructions from to install from Tensorflow website.

Please, check Your CPU/Python is on 32 bits?Please, refer #36167 and see if it helps you.Please, refer similar issues #36167 #36151 #36138 #36054 #36045 #36020 #36003 #35988 #35903 #35880 #35865 #35805 #35789 #35773 #35772 #35767 #35766 #35749 #35721 #35618 #35204
Thanks!

@google-ml-butler
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.

@google-ml-butler google-ml-butler bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Aug 17, 2020
@google-ml-butler
Copy link

Closing as stale. Please reopen if you'd like to work on this further.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author subtype:windows Windows Build/Installation Issues TF 2.3 Issues related to TF 2.3 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

2 participants