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

ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found. #43192

Closed
Pranab-pronay opened this issue Sep 13, 2020 · 9 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author type:build/install Build and install issues

Comments

@Pranab-pronay
Copy link

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):win10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary):binary
  • TensorFlow version:2.2.0
  • Python version:3.8.5
  • Installed using virtualenv? pip? conda?:conda
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:10.1
  • GPU model and memory:nvidia940m, 4 gb

Describe the problem I am confident that I've installed Cuda and cudnn properly and added path in the environment variable, but still, I am getting this error

Provide the exact sequence of commands / steps that you executed before running into the problem
I am following their step: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html#tensorflow-object-detection-api-installation
When I tried for "python object_detection/builders/model_builder_tf2_test.py" I am facing this error

Any other info / logs (tensorflow1) C:\tensorflow1\models\research>python object_detection/builders/model_builder_tf2_test.py
Traceback (most recent call last):
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Pranab\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\Pranab\Anaconda3\envs\tensorflow1\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "object_detection/builders/model_builder_tf2_test.py", line 21, in
import tensorflow.compat.v1 as tf
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python_init
.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Pranab\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\Pranab\Anaconda3\envs\tensorflow1\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 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.
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.

@Pranab-pronay Pranab-pronay added the type:build/install Build and install issues label Sep 13, 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.

@bhack
Copy link
Contributor

bhack commented Sep 13, 2020

We don't support Anaconda installation.
Please try to install TF with pip/venv as https://www.tensorflow.org/install/pip
If you need Anaconda you could rely on third party support at https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/

/cc @karmel @av8ramit We could improve this new tensorflow-butler reply with a better text when there is an Anaconda string in the issue description.
It Is a quite recurrent case specially for Windows tickets. I've triaged many of these just the last few days.

@Pranab-pronay
Copy link
Author

Pranab-pronay commented Sep 13, 2020

@bhack Sorry I've mistakenly written that used conda, I used pip for installation, Btw I fixed this by running setup.py, But I am getting another error now.
(tensorflow1) C:\tensorflow1\models\research>python object_detection/builders/model_builder_tf2_test.py
Traceback (most recent call last):
File "object_detection/builders/model_builder_tf2_test.py", line 21, in
import tensorflow.compat.v1 as tf
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python_init
.py", line 40, in
from tensorflow.python.eager import context
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\eager\context.py", line 32, in
from tensorflow.core.framework import function_pb2
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 7, in
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)

@bhack
Copy link
Contributor

bhack commented Sep 13, 2020

From you last log I still see that you are inside an Anaconda3 envs.
Under the conda tab in the documentation:

While the TensorFlow provided pip package is recommended, a community-supported Anaconda package is available. To install, read the Anaconda TensorFlow guide.

@bhack
Copy link
Contributor

bhack commented Sep 13, 2020

We support python venv and pip. If you want you can follow the guidelines at https://www.tensorflow.org/install/pip#windows_1.

Instead if you still need to use conda envs and Anaconda you need to find support at: https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/

Please also respect our code of conduct (/cc @theadactyl) : https://github.com/tensorflow/tensorflow/blob/master/CODE_OF_CONDUCT.md

@Pranab-pronay
Copy link
Author

@bhack can you help me out:-

(tensorflow1) C:\tensorflow1\models\research>python object_detection/builders/model_builder_tf2_test.py
Traceback (most recent call last):
File "object_detection/builders/model_builder_tf2_test.py", line 21, in
import tensorflow.compat.v1 as tf
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python_init
.py", line 40, in
from tensorflow.python.eager import context
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\eager\context.py", line 32, in
from tensorflow.core.framework import function_pb2
File "C:\Users\Pranab\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 7, in
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)

I am not getting this error.

@bhack
Copy link
Contributor

bhack commented Sep 13, 2020

We cannot support you on Anacoda sorry.

@Saduf2019
Copy link
Contributor

@Pranab-pronay
You could be facing this issue because of the following reasons

  • You you running 32-bit Python or 32-bit OS
  • Please take a look at the system requirements and check if you have the correct dependencies installed.
  • Your CPU does not support AVX instructions, please provide the make and model of your CPU in this case.

Also, check these similar duplicate issues: #42058 #41596 #40459 #39007 #38916 #36167 #36151 #36138 #36054 #36045 #36020 #36003 #35988 #35903 #35880 #35865 #35805 #35789 #35773 #35772 #35767 .

In case you still face issues after verifying the above, please create a issue on Anaconda repo., and move this to closed status.
Thanks!

@Saduf2019 Saduf2019 added the stat:awaiting response Status - Awaiting response from author label Sep 14, 2020
@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
stat:awaiting response Status - Awaiting response from author type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

3 participants