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

Help! I have an issue when importing TF! #36167

Closed
Brayden1000 opened this issue Jan 23, 2020 · 5 comments
Closed

Help! I have an issue when importing TF! #36167

Brayden1000 opened this issue Jan 23, 2020 · 5 comments
Labels
subtype:windows Windows Build/Installation Issues TF 2.1 for tracking issues in 2.1 release type:build/install Build and install issues

Comments

@Brayden1000
Copy link

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
    no, it is custom code but I did not write it https://medium.com/swlh/nvidia-jetson-nano-custom-object-detection-from-scratch-using-tensorflow-and-opencv-113fe4dba134 I got it from here and the TF conversion script
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 x64
  • TensorFlow installed from (source or binary): I installed with pip install Tensorflow and Tensorflow-gpu
  • TensorFlow version (use command below): 2.1.0
  • Python version: 3.7.6
  • CUDA/cuDNN version: 10.1
  • GPU model and memory: 960M 4gb

Describe the current behavior
When I run the script I get the error Failed to load the native TensorFlow runtime. with a bunch of other errors that I will paste down bellow.

Describe the expected behavior
To run the script lol

Code to reproduce the issue
I am just running python and then the directory to the .py file

Any help is appreciated thanks!!!!

Other info / logs
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Python37\lib\imp.py", line 342, 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 "C:\Users\minec\Desktop\Robotics_stuff\TFconvert.py", line 4, in
import tensorflow as tf
File "C:\Python37\lib\site-packages\tensorflow_init_.py", line 101, in
from tensorflow_core import *
File "C:\Python37\lib\site-packages\tensorflow_core_init_.py", line 40, in
from tensorflow.python.tools import module_util as module_util
File "C:\Python37\lib\site-packages\tensorflow_init
.py", line 50, in getattr
module = self.load()
File "C:\Python37\lib\site-packages\tensorflow_init
.py", line 44, in _load
module = importlib.import_module(self.name)
File "C:\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap.gcd_import(name[level:], package, level)
File "C:\Python37\lib\site-packages\tensorflow_core\python_init
.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python37\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

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.

@mihaimaruseac
Copy link
Collaborator

This issue shows up in multiple places #36167 #36151 #36138 #36054 #36045 #36020 #36003 #35988 #35903 #35880 #35865 #35805 #35789 #35773 #35772 #35767 #35766 #35749 #35721 #35618 #35204

No such place mentions which DLL fails or differentiates from the others.

@Brayden1000
Copy link
Author

This issue shows up in multiple places #36167 #36151 #36138 #36054 #36045 #36020 #36003 #35988 #35903 #35880 #35865 #35805 #35789 #35773 #35772 #35767 #35766 #35749 #35721 #35618 #35204

No such place mentions which DLL fails or differentiates from the others.

Yeah I've seen that it had been mentioned a lot of times any solutions that you have found or no?

@mihaimaruseac
Copy link
Collaborator

There are at least 3 possible scenarios:

  1. You need to install the MSVC 2019 redistributable
  2. Your CPU does not support AVX2 instructions
  3. Your CPU/Python is on 32 bits
  4. There is a library that is in a different location/not installed on your system that cannot be loaded.

@gunan
Copy link
Contributor

gunan commented Jan 24, 2020

Could you share your CPU make and model?

@bmzhao
Copy link
Member

bmzhao commented Feb 2, 2020

Hi @Brayden1000,

Did you install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019?

According to the docs at https://www.tensorflow.org/install/pip,

Install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019. Starting with the TensorFlow 2.1.0 version, the msvcp140_1.dll file is required from this package (which may not be provided from older redistributable packages). The redistributable comes with Visual Studio 2019 but can be installed separately:

Go to the Microsoft Visual C++ downloads,
Scroll down the page to the Visual Studio 2015, 2017 and 2019 section.
Download and install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 for your platform.
Make sure long paths are enabled on Windows.

Install the 64-bit Python 3 release for Windows (select pip as an optional feature).

Tensorflow 2.1.0 is compiled using MSVC 2019, which appears to require an additional DLL.

@Saduf2019 Saduf2019 mentioned this issue Mar 2, 2021
This was referenced Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subtype:windows Windows Build/Installation Issues TF 2.1 for tracking issues in 2.1 release type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants