Skip to content

ImportError: No module named '_pywrap_tensorflow_internal' #9469

Closed
@quatre008

Description

@quatre008

Hi all,

Using windows 7 and have made tensorflow work in the cpu version. But keep getting this error in the gpu version.

Installed it using pip install tensorflow-gpu. Have cuda 8.0 and cudnn 5.1. Have the dll file and cudnn files copied over. GPU model is K610M.

Thanks in advance for the assistance.

Capture of the screen:
(C:\Users\KiraYamato\Anaconda3) C:\Users\KiraYamato>activate tensorflow-gpu

(tensorflow-gpu) C:\Users\KiraYamato>python
Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [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 "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\importlib_init_
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 914, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\importlib_init

.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python_init_.py", line 51, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\importlib_init_
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 914, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tens
orflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\KiraYamato\Anaconda3\envs\tensorflow-gpu\lib\importlib_init

.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

Activity

kdexd

kdexd commented on Apr 27, 2017

@kdexd

Hi @quatre008,
As the stack overflow link suggests, have you tried to invoke tensorflow by staying out of the source code directory?

Carmezim

Carmezim commented on Apr 27, 2017

@Carmezim
Contributor

Hi @quatre008, sorry you're facing issues, could you please check if your CUDA and cuDNN DLLs are properly set on your %PATH%?

quatre008

quatre008 commented on Apr 27, 2017

@quatre008
Author

Hi,

@karandesai-96 I tried many different directories and still the same. Tensorflow worked but not tensorflow gpu.

@Carmezim How do I know if it is properly set? I only found the following:
PATH: C:\Users\KiraYamato\Anaconda3;C:\Users\KiraYamato\Anaconda3\Scripts;C:\Users\KiraYamato\Anaconda3\Library\bin
CUDA_PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
CUDA_PATH_V8_0: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

Carmezim

Carmezim commented on Apr 27, 2017

@Carmezim
Contributor

@quatre008 what happens sometimes is that cuDNN DLLs are installed in a different directory of CUDA so you need to add it also. Make sure you installed cuDNN correctly and if its DLLs are not in those directories already in your %PATH% you need to add them.

quatre008

quatre008 commented on Apr 27, 2017

@quatre008
Author

@Carmezim I have copied the files into the same CUDA directory as mentioned. So I am guessing it should be working fine. I have re-downloaded and overwritten to make sure this was the case too.

Carmezim

Carmezim commented on Apr 27, 2017

@Carmezim
Contributor

@quatre008 If you went over CUDA and cuDNN installation again and made sure you have everything properly set, completely uninstall TensorFlow and install it (only GPU) again. If the problem persists then it's not CUDA/cuDNN related.

quatre008

quatre008 commented on Apr 27, 2017

@quatre008
Author

Ok I finally managed to resolve the issue.

2 issues at work here. One being my Visual Studio was not installed properly, and the second one (outside of this topic but still interesting) is that my laptop has dual graphics boot-up.

So for the first issue, I managed to resolve it by deleting most folders and restarting the installation, starting from visual studio (the free version of community VS2017 did not work previously).

Then as for the second issue, I only need to remove intel graphics from the bootup menu and solely use the K610M that I am having and everything is fine now, except for a list of warning messages that seems to be common in most cases.

Thanks for the help again. Much appreciated.

aselle

aselle commented on Apr 27, 2017

@aselle
Contributor

Glad you got it resolved, and thank you for reporting information to help others in the future. Closing for now.

MuhammadHamed

MuhammadHamed commented on May 31, 2017

@MuhammadHamed

Hi @quatre008 ... I am having the same error as u had. Which visual studio version did u use ?

mateon1

mateon1 commented on Jun 10, 2017

@mateon1

Hi, I am having this issue on Linux. I am trying to install tensorflow with pypy.
My ./configure has everything default except the python interpreter /usr/local/bin/pypy.
When importing I get:

Python 2.7.13 (c925e73810367cd960a32592dd7f728f436c125c, Jun 08 2017, 09:20:57)
[PyPy 5.8.0 with GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/root/nn/pypy2-v5.8.0-src/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    import _pywrap_tensorflow_internal
ImportError: No module named _pywrap_tensorflow_internal


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
>>>> 

30 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tomzx@aselle@banyh@mateon1@lintseju

        Issue actions

          ImportError: No module named '_pywrap_tensorflow_internal' · Issue #9469 · tensorflow/tensorflow