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: No module named '_pywrap_tensorflow_internal' #48267

Closed
vanshika-653 opened this issue Apr 2, 2021 · 7 comments
Closed

ImportError: No module named '_pywrap_tensorflow_internal' #48267

vanshika-653 opened this issue Apr 2, 2021 · 7 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 TF 1.15 for issues seen on TF 1.15 type:build/install Build and install issues

Comments

@vanshika-653
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):Windows 10 64amd
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary):
  • TensorFlow version:1.5.0
  • Python version:3.5.2 , 3.6,3.7,3.8 & 3.9.2 64amd
  • Installed using virtualenv? pip? conda?:
  • Bazel version (if compiling from source):
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:

Describe the problem
C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\sign-language-gesture-recognition-master>python retrain.py --bottleneck_dir=bottlenecks --summaries_dir=training_summaries/long --output_graph=retrained_graph.pb --output_labels=retrained_labels.txt --image_dir=train_frames
Traceback (most recent call last):
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\sign-language-gesture-recognition-master\retrain.py", line 132, in
import tensorflow as tf
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python_init_.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Vanshika Gupta\AppData\Local\Programs\Python\Python39\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Provide the exact sequence of commands / steps that you executed before running into the problem

Any other info / logs
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.

@vanshika-653 vanshika-653 added the type:build/install Build and install issues label Apr 2, 2021
@Saduf2019 Saduf2019 added the TF 1.15 for issues seen on TF 1.15 label Apr 5, 2021
@Saduf2019
Copy link
Contributor

@vanshika-653
We see that you are using an old version of TensorFlow for which there is no support, can you please upgrade to 2.x [2.4] and let us know if you till face the issue reported.
You may refer to few old issues with same error: #22512, link, link1

@Saduf2019 Saduf2019 added the stat:awaiting response Status - Awaiting response from author label Apr 5, 2021
@GQster
Copy link

GQster commented Apr 8, 2021

I am getting a similar error:

when running in jupyter notebook:

ModuleNotFoundError: No module named '_pywrap_tensorflow'

Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

when just trying to import if va cmd:
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

Any solutions would be great! thanks

@Saduf2019
Copy link
Contributor

@grantcroft
Please share your code such that we can replicate the issue reported, or a colab gist with the error and version used.

@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 Apr 20, 2021
@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

@nsa-123
Copy link

nsa-123 commented Apr 18, 2022

I am also facing the same error.

python --version gave
Python 3.7.0

Tensorflow version is

(0.12.0)

I have already installed Microsoft Visual C++ Redistribution (x64) 9.0.30729.17/.6161 / .21022 /(x86) 30729.17/ (x86) 30729.6161

Microsoft Visual C++ Redistribution2015-2019 (x64) 14.25.28508
Microsoft Visual C++ Redistribution2015-2019 (x64) 14.31.31103

I have included path to all dlls to environment variable path.

OS is Win 7 Ultimate.

When I do
import tensorflow as tf

I get following error
`---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in swig_import_helper()
17 try:
---> 18 fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
19 except ImportError:

h:\python installed\lib\imp.py in find_module(name, path)
296 else:
--> 297 raise ImportError(_ERR_MSG.format(name), name=name)
298

ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

ModuleNotFoundError Traceback (most recent call last)
h:\python installed\lib\site-packages\tensorflow\python_init_.py in
53 # use dlopen() for dynamic loading.
---> 54 from tensorflow.python import pywrap_tensorflow
55 except ImportError:

h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
27 return _mod
---> 28 _pywrap_tensorflow = swig_import_helper()
29 del swig_import_helper

h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in swig_import_helper()
19 except ImportError:
---> 20 import _pywrap_tensorflow
21 return _pywrap_tensorflow

ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
----> 1 import tensorflow as tf
2 from tensorflow.keras.utils import to_categorical

h:\python installed\lib\site-packages\tensorflow_init_.py in
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
25 # pylint: enable=wildcard-import
26

h:\python installed\lib\site-packages\tensorflow\python_init_.py in
58 please exit the tensorflow source tree, and relaunch your python interpreter
59 from there.""" % traceback.format_exc()
---> 60 raise ImportError(msg)
61
62 # Protocol buffers

ImportError: Traceback (most recent call last):
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "h:\python installed\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "h:\python installed\lib\site-packages\tensorflow\python_init_.py", line 54, in
from tensorflow.python import pywrap_tensorflow
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.`

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 TF 1.15 for issues seen on TF 1.15 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants