Tensorflow import error: No module named 'tensorflow'
I installed TensorFlow on my Windows Python 3.5 Anaconda environment The validation was successful (with a warning)
Python 3.5.3 |Intel Corporation| (default, Apr 27 2017, 17:03:30) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information. Intel(R) Distribution for Python is brought to you by Intel Corporation. Please check out: https://software.intel.com/en-us/python-distribution
>>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session()
2017-10-04 11:06:13.569696: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
However, when I attempt to import it into my python code
from __future__ import print_function, division import numpy as np import os import matplotlib import tensorflow as tf
I get this error
ImportError: No module named 'tensorflow'
This is the location of the tensorflow package on my C drive
When I go to Anaconda Navigator, it seems I have to choose either root, Python35, or Tensorflow. It looks like the Tensorflow environment includes Python35.
Anaconda Navigator launcher had to be reinstalled recently, possibly due to the Tensorflow installation. Maybe if there were another way to set the environment to Tensorflow within Anaconda /Spyder IDE other than the Navigator it might help
Method of installing tensorflow
conda create --name tensorflow python=3.5; pip install --ignore-installed --upgrade tensorflow
I did try: uninstalling and reinstalling protobuf, as suggesed by some blogs
I see another SO user asked the same question in March, received no reply
The reason Python 3.5 environment is unable to import Tensorflow is that Anaconda does not store the tensorflow package in the same environment.
One solution is to create a new separate environment in Anaconda dedicated to TensorFlow with its own Spyder
conda create -n newenvt anaconda python=3.5 activate newenvt
and then install tensorflow into newenvt
I found this primer helpful
ModuleNotFoundError: No module named 'tensorflow' · Issue , After conda install tensorflow and conda activate tensorflow_env while running code import tensorflow as tf Error ModuleNotFoundError When we setup TensorFlow we created a new virtual environment named “Python 3.6 (TensorFlow)”. Note: I might have updated the instructions to a version later than Python 3.7 once TensorFlow (and related libraries fully support later versions of Python).
In Windows 64, if you did this sequence correctly:
conda create -n tensorflow python=3.5 activate tensorflow pip install --ignore-installed --upgrade tensorflow
Be sure you still are in tensorflow environment. The best way to make Spyder recognize your tensorflow environment is to do this:
conda install spyder
This will install a new instance of Spyder inside Tensorflow environment. Then you must install scipy, matplotlib, pandas, sklearn and other libraries. Also works for OpenCV.
Always prefer to install these libraries with "conda install" instead of "pip".
'No module named tensorflow' after installing via pip · Issue #6548 , The next error that pops up is ImportError: cannot import name 'multiarray' , from numpy. When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath' Hot Network Questions Dividing elements of a list by their positions
The reason why Python base environment is unable to import Tensorflow is that Anaconda does not store the tensorflow package in the base environment.
create a new separate environment in Anaconda dedicated to TensorFlow as follows:
conda create -n newenvt anaconda python=python_version
replace python_version by your python version
activate the new environment as follows:
Then install tensorflow into the new environment (newenvt) as follows:
conda install tensorflow
Now you can check it by issuing the following python code and it will work fine.
Why am I getting ImportError: No module named tensorflow , This error usually looks something like the following: ImportError: No module named tensorflow. This error can be caused by a variety of issues. import numpy as np import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets(“MNIST_data”, one_hot=True) But i got this error: ModuleNotFoundError: No module named 'tensorflow.examples.tutorials' Do you know why? TF version 2.2.0
I think your tensorflow is not installed for local environment.The best way of installing tensorflow is to create virtualenv as describe in the tensorflow installation guide Tensorflow Installation .After installing you can activate the invironment and can run anypython script under that environment.
Whenever I run a code, it gives me an error of “ImportError: No , Whenever I run a code, it gives me an error of “ImportError: No module named 'tensorflow'”. How can I resolve this? EDIT : I found that tensorflow is trying to import _pywrap_tensorflow_internal as a module but in fact it's a *.pyd python tensorflow share | improve this question | follow |
deleting tensorflow from cDrive/users/envs/tensorflow and after that
conda create -n tensorflow python=3.6 activate tensorflow pip install --ignore-installed --upgrade tensorflow
now its working for newer versions of python thank you
ModuleNotFoundError: No module named 'tensorflow', Hi Guys,. I installed tensorflow in my system, but I am not able to import this module. I got this below error. ModuleNotFoundError Traceback i can't import tensorflow in python because it says 'ModuleNotFoundError: No module named 'tensorflow.contrib'' tensorflow version is 2.x what should i do? windows 8.1 complete nooob to ml and ai (i am new to github)
Python 3.6 ModuleNotFoundError: No module named tensorflow , Python 3.6 ModuleNotFoundError: No module named 'tensorflow' sudo apt install Duration: 3:14 Posted: Mar 17, 2018 I have tried as you said, but it did not work. >>> from tensorflow.python.compiler import tensorrt as trt. Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'tensorrt'
ImportError: No module named tensorflow, You can try install tensorflow again with the specific version you want (or whatever it will install), but put --ignore-installed flag to ignore existing import _pywrap_tensorflow_internal ModuleNotFoundError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime.
Build and install error messages, Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from ImportError: No module named copyreg. Importing submodules from tensorflow.keras fails with error: ModuleNotFoundError: No module named 'tensorflow.keras'. but import tensorflow as tf and then doing tf.keras.datasets works. This is a big inconsistency, also it means that every time an element from within the tensforlow.keras module you need to write the complete path (which is very