No module named tensorflow.python Windows 10 - python

I'm trying to use Tensorflow for image recognition but I keep getting this error:
Traceback (most recent call last):
File "classify_image.py", line 46, in <module>
import tensorflow as tf
File "C:\Users\Diederik\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
ModuleNotFoundError: No module named 'tensorflow.python'

Related

Error when importing Tensorflow - Failed to load the native TensorFlow runtime

Here's the full error:
Traceback (most recent call last):
File "C:\Users\richa\Documents\_Projects_\Astr0loger\interface.py", line 26, in <module>
from controller import choose_best_stocks
File "C:\Users\richa\Documents\_Projects_\Astr0loger\controller.py", line 10, in <module>
from trainer import get_data, train_model, test_model
File "C:\Users\richa\Documents\_Projects_\Astr0loger\trainer.py", line 12, in <module>
import tensorflow as tf
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
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.
Apparently there are three common causes/fixes to the problem:
Python is 32 bit while the system is 64 bit, or vice versa. I checked, that is not the case.
cpu doesn't support AVX2 instructions - I tried tensorflow-gpu, same issue, so I don't think that's it
You need to install the MSVC 2019 redistributable - I checked, I have it
AAAAAAAAAAH What do I do?
Well, turns out the error was fixed by installing an older version of Tensorflow; 2.0.0. If you're having the same issue, try several versions of tensorflow.

" AttributeError: module 'numpy' has no attribute 'integer' " getting this error while running tensorboard from command prompt

While running the commamd : tensorboard --logdir=training/
I am getting some error in code.
Tried updating the numpy library.
Traceback (most recent call last):
File "/home/apoorva/.local/bin/tensorboard",
line 6, in <module>
from tensorboard.main import run_main
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorboard/main.py", line 42, in <module>
import tensorflow as tf # pylint: disable=unused-import
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 63, in <module>
from tensorflow.python.framework.framework_lib import * # pylint: disable=redefined-builtin
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/framework/framework_lib.py", line 25, in <module>
from tensorflow.python.framework.ops import Graph
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 40, in <module>
from tensorflow.python.eager import context
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/eager/context.py", line 30, in <module>
from tensorflow.python.framework import c_api_util
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/framework/c_api_util.py", line 25, in <module>
from tensorflow.python.util import compat
File "/home/apoorva/.local/lib/python3.6/site-packages/tensorflow/python/util/compat.py", line 129, in <module>
integral_types = (_numbers.Integral, _np.integer)
AttributeError: module 'numpy' has no attribute 'integer'
numpy version : 1.16.2
tensorboard : 1.13.1
tensorflow : 1.13.1
I expect tensorboard interface to pop-up.

Error when executing Python inference.py script

I am working on designing a chatbot using tensorflow in python, I have windows 10 (64 bit) installed with python version 3.6.0.
when trying to execute Python inference.py I got the following error
Traceback (most recent call last):
File "inference.py", line 9, in
from nmt import nmt
File "C:\Users\Ali\Documents\Visual Studio 2017\Projects\SequenceToSequenceModel\nmt-chatbot/nmt\nmt\nmt.py", line 26, in
import tensorflow as tf
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow__init__.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow\python__init__.py", line 59, in
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in
from google.protobuf import descriptor as _descriptor
File "c:\users\ali\appdata\roaming\python\python36\site-packages\google\protobuf\descriptor.py", line 47, in
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
I appreciate any help you provide.

import tensorflow giving error in windows

I am using a 64 bit windows OS and I successfully installed tensorflow but on importing it in python 3.6 , I am getting the following error.
Please tell how to fix this.
import tensorflow
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import tensorflow
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 59, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.

TensorFlow for Mac: error importing tensorflow

I'm trying to use TensorFlow on my Mac.
I'm in terminal and have followed all directions on the Tensorflow Install page until "Run a short test program"
I'm attempting to write
import tensorflow as tf
But I receive the following message
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
Failed to load the native TensorFlow runtime.
Any help would be great!
It seems that you have an incompatible numpy version.
You need to upgrade numpy
You can run
pip install --upgrade numpy
to upgrade numpy to its latest version

Categories

Resources