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

Error in importing tensorflow #22823

Closed
Dudu197 opened this issue Oct 9, 2018 · 15 comments
Closed

Error in importing tensorflow #22823

Dudu197 opened this issue Oct 9, 2018 · 15 comments
Assignees
Labels
type:build/install Build and install issues

Comments

@Dudu197
Copy link

Dudu197 commented Oct 9, 2018

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 Home
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow installed from (source or binary): pip install tf-nightly-gpu
  • TensorFlow version (use command below): Can't see (error while importing)
  • Python version: 3.6.0
  • Bazel version (if compiling from source): N/A
  • CUDA/cuDNN version: Cuda 9.1; cuDNN 7.2.1
  • GPU model and memory: GTX 1060 6Gb
  • Exact command to reproduce: import tensorflow as tf

Describe the problem

Error while importing tensorflow.
I have successfully installed via pip, but while I'm trying to import I get the log listed error.
Unfortunately, the error dosen't describe which DLL is missing, and all tickets I've seen doesn't solved my problem.

Source code / logs

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf
Traceback (most recent call last):
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Program Files\Python36\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 "D:\Program Files\Python36\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "D:\Program Files\Python36\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 "", line 1, in
File "D:\Program Files\Python36\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python_init_.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Program Files\Python36\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 "D:\Program Files\Python36\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "D:\Program Files\Python36\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.

@tensorflowbutler tensorflowbutler added the stat:awaiting response Status - Awaiting response from author label Oct 9, 2018
@tensorflowbutler
Copy link
Member

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Bazel version
Mobile device

@Dudu197
Copy link
Author

Dudu197 commented Oct 9, 2018

Updated as requested.

@ymodak ymodak added the type:build/install Build and install issues label Oct 9, 2018
@ymodak
Copy link
Contributor

ymodak commented Oct 9, 2018

I suspect you are using incorrect cuDNN version for Windows compatibility. Can you please try with cuDNN 7.1.4.
Also please take a look at similar issue #22794

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Oct 10, 2018
@Dudu197
Copy link
Author

Dudu197 commented Oct 14, 2018

I still got the same error.

But, reading the test bat it raised me one question, am I missing any env path?
I have created the LIBRARY_INC, LIBRARY_LIB and LIBRARY_BIN paths, but I still got the same error.

Is there any list about the environment variables I should have?

Thanks.

@ymodak ymodak assigned gunan and unassigned ymodak Oct 17, 2018
@gunan
Copy link
Contributor

gunan commented Oct 17, 2018

There are two potential issues.
First, we need to check your CPU model, does your CPU support AVX instruction sets?
Next, MSVC 2015 redistributable update 3. It is listed here under windows:
https://www.tensorflow.org/install/pip

@Dudu197
Copy link
Author

Dudu197 commented Oct 18, 2018

My current CPU supports AVX (I7 7700HQ), and tensorflow on CPU installs and runs fine.
MSVC 2015 is also installed and working (since I've compiled dlib with GPU support).

By reading https://www.tensorflow.org/install/gpu, the "Windows Setup" part defined the path as v9.0, but mine is v9.1.
Is the tensorflow expecting the v9.0?
My path var is setted to v9.1.

Thanks.

@gunan
Copy link
Contributor

gunan commented Oct 18, 2018

Yes, tensorflow prebuilt libraries require CUDA 9.0 to run.

@Dudu197
Copy link
Author

Dudu197 commented Oct 18, 2018

It worked!
After installing the CUDA 9.0 (instead of 9.1) I was able to successfully import and print the current version of tensorflow-gpu.

I guess I'll have no more trouble in using tensorflow.

Thanks for all support and help,
Carlos.

@Dudu197 Dudu197 closed this as completed Oct 18, 2018
@gargisri68
Copy link

image

I cannot import tensorflow.

@RostyxCZ
Copy link

Hi, please help me, I am getting this - same as person above. I think I did whole instalation properly, I tried it for 3 times but it always result in same error. I am using Python 3.7.2, anaconda, tensorflow-gpu 1.13.1, CUDA 10.1, cuDNN 7.5.

@gargisri68
Copy link

gargisri68 commented Mar 22, 2019 via email

@gargisri68
Copy link

gargisri68 commented Mar 22, 2019 via email

@RostyxCZ
Copy link

[SOLVED] Okay, so my problem is solved. Actually successfuly running on :
CUDA 9.0, cuDNN 7.3.1, python 3.6.0 (Anaconda), tensorflow 1.12 with my GPU Nvidia GTX 1050 Ti.

Thanks alot for your help and this tread in general 💯

@Bocul16
Copy link

Bocul16 commented Jul 25, 2019

anybody can help me
im running on: PyCharm 2019 1.3, Anaconda3 2019.03, Tensorflow 1.14.0 GPU Nvidia GTX 950 CUDA 10.0 cuDNN 7.1.4

C:\Users\bonix\Anaconda3\envs\tensor\pythonw.exe C:/Users/bonix/PycharmProjects/TensorPye/testing.py
Traceback (most recent call last):
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\bonix\Anaconda3\envs\tensor\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\bonix\Anaconda3\envs\tensor\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 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/bonix/PycharmProjects/TensorPye/testing.py", line 1, in
import tensorflow
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow_init_.py", line 28, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python_init_.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\bonix\Anaconda3\envs\tensor\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\bonix\Anaconda3\envs\tensor\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\bonix\Anaconda3\envs\tensor\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 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.

Process finished with exit code 1

@Dudu197
Copy link
Author

Dudu197 commented Jul 25, 2019

@Bocul16 try using CUDA 9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

7 participants