Reputation: 1771
I successfully installed tensorflow on my windows 10 using the cmd command:
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
However, when I use PyCharm to run a simple code such as:
import tensorflow as tf
node1 = tf.constant(3.0, dtype=tf.float32)
node2 = tf.constant(4.0) # also tf.float32 implicitly
print(node1, node2)
I get the following error on the console:
Traceback (most recent call last):
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 18, in
swig_import_helperfp, pathname, description =
imp.find_module('_pywrap_tensorflow', [dirname(__file__)])
File "C:\Users\Name\Desktop\Desktop\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\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\__init__.py", line 66, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Name\Desktop\Desktop\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/Name/Desktop/Desktop/ML/tfbasics.py", line 1, in <module>
import tensorflow as tf
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Name\Desktop\Desktop\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\Name\Desktop\Desktop\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\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\__init__.py", line 66, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Name\Desktop\Desktop\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 20, in
swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'
I researched the web to fix this bug but found conflicting results that did not help. Anyone can point to why this bug is occurring ?
Upvotes: 2
Views: 700
Reputation: 96
Im not sure why you used Mac when you want to run it on Windows
pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl
from the manual
Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command:
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.3.0-cp35-cp35m-win_amd64.whl To install the GPU version of TensorFlow, enter the following command (on a single line):
(tensorflow)C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.3.0-cp35-cp35m-win_amd64.whl
Also please dont forget
TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you'll use to install TensorFlow.
Upvotes: 1