Installation of Tensorflow 0.12.0 on Windows 7

I am trying to install tensorflow in Windows 7 ultimate
Python --verion return
Python 3.7.0

Tensorflow version is 0.12.0

I dont have Anaconda or conda environment installed on PC.

Project requirements prevent me going to colab/kaggle enviroments

I have path to all the requesite dll’s in the PATH env variable

PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;F:\app\nakul\product\11.2.0\dbhome_1\bin;
C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Java\jdk1.6.0_18\bin;
C:\Program Files (x86)\nodejs;C:\Program Files\TortoiseHg;
c:\Program Files\Mozilla Firefox;
C:\Program Files\Mozilla Firefox;C:\Program Files (x86)\Java\jdk1.8.0_45\bin
;H:\Softwares\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin;
C:\Windows\System32\WindowsPowerShell\v1.0;
C:\Windows\system;
C:\Program Files\Mozilla Firefox;
H:\Python Installed\Scripts;
H:\Python Installed;
C:\Users\nakul\AppData\Roaming\npm;
I:\MikiTextInstall\miktex\bin\x64;
C:\Users\nakul\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;
C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\bin;;
C:\Program Files\Mozilla Firefox;F:\MS\Microsoft VS Code\bin;
H:\Softwares\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin;
F:\data sciece\vivek;C:\Users\nakul\AppData\Local\Pandoc;
H:\Python Installed\Lib\site-packages\graphviz;search-ms:displayname=Search%20Results%20in%20Python%20Installed&crumb=location:H%3A%5CPython%20Installed\graphviz-0.19.1.dist-info;C:\Windows\SysWOW64;C:\Windows\System32;C:\Windows\winsxs\x86_microsoft-windows-u…rsalcrt-apifwd-win7_31bf3856ad364e35_6.1.7601.23303_none_4e5c9e3785a6634a;
H:\Python Installed;

upon executing 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.

I have tried solutions mentioned at following urls:-

  1. ImportError: No module named '_pywrap_tensorflow_internal' · Issue #48267 · tensorflow/tensorflow · GitHub
  2. ImportError: No module named '_pywrap_tensorflow' Failed to load the native TensorFlow runtime. · Issue #8385 · tensorflow/tensorflow · GitHub
  3. Invalid syntax error while importing tensorflow in python3.7.0 · Issue #20690 · tensorflow/tensorflow · GitHub
    (Reported the same issue there as well)

Any leads on how to solve this problem?

Thanking You
sunforu

Hi @sun_foru TensorFlow 0.12.0 supports python 3.5. For reference please refer to this link.Thanks.

1 Like

Hi,
Thank you @Kiran_Sai_Ramineni for reply.

I have tried upgrading the existing tensorflow using pip. I get following error:-

> 
> WARNING: Ignoring invalid distribution -ip (h:\python installed\lib\site-package
> s)
> WARNING: Ignoring invalid distribution -ip (h:\python installed\lib\site-package
> s)
> Requirement already satisfied: tensorflow in h:\python installed\lib\site-packag
> es (0.12.0)
> Requirement already satisfied: wheel>=0.26 in h:\python installed\lib\site-packa
> ges (from tensorflow) (0.37.1)
> Requirement already satisfied: numpy>=1.11.0 in h:\python installed\lib\site-pac
> kages (from tensorflow) (1.21.5)
> Requirement already satisfied: protobuf==3.1.0 in h:\python installed\lib\site-p
> ackages (from tensorflow) (3.1.0)
> Requirement already satisfied: six>=1.10.0 in h:\python installed\lib\site-packa
> ges (from tensorflow) (1.16.0)
> Requirement already satisfied: setuptools in h:\python installed\lib\site-packag
> es (from protobuf==3.1.0->tensorflow) (60.8.2)
> WARNING: Ignoring invalid distribution -ip (h:\python installed\lib\site-package
> s)
> WARNING: Ignoring invalid distribution -ip (h:\python installed\lib\site-package
> s)
> WARNING: Ignoring invalid distribution -ip (h:\python installed\lib\site-package
> s)
> 
> __VIRTUAL_PROMPT__C:\Users\nakul\AppData\Roaming\Python\Python37\site-packages\v
> irtualenv>

Hi @sun_foru are you installing TensorFlow 2.8 or TensorFlow 0.12.0 can you please confirm. And can you please provide some details like in which environment you are installing the TensorFlow.Thanks.

1 Like

Hi @Kiran_Sai_Ramineni ,

My overall environment is

Window :7 Ultimate Edition
Python : 3.7.0

As shown in the previous posts, I had installed TensorFlow 0.12.0. But as you said that the support for this version(0.12.0) is not available for the python 3.7.0. I have now uninstalled 0.12.0 version of tensorflow. I now executed below command within virtualenv
__VIRTUAL_PROMPT__C:\Users\AppData\Roaming\Python\Python37\site-packages\v
irtualenv>pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/c
pu/tensorflow-1.0.0-py3-none-any.whl

The installation of this Tensorflow 1.0.0 is successful.

But still within jupyter environment I am getting error message as below

---------------------------------------------------------------------------
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 <module>
     65     # use `dlopen()` for dynamic loading.
---> 66     from tensorflow.python import pywrap_tensorflow
     67 except ImportError:

h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     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)
<ipython-input-1-f83c6d50081b> in <module>
----> 1 import tensorflow as tf
      2 print(tf.__version__)

h:\python installed\lib\site-packages\tensorflow\__init__.py in <module>
     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 <module>
     70 for some common reasons and solutions.  Include the entire stack trace
     71 above this error message when asking for help.""" % traceback.format_exc()
---> 72   raise ImportError(msg)
     73 
     74 # 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 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    _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'


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.


Hi @sun_foru as mentioned in the TensorFlow official documentation TensorFlow 1.0.0 supports python 3.5 . Please refer to the installation guide for more information here.Thanks.

1 Like

Hi,

i did the following and installation was successful(apparently) it seems:

  1. Installed Python 3.7 (64 bit)
  2. Ran pip from python/scripts as:

pip install tensorflow

After this in jupyter following code is successfully running without errors.

import tensorflow as tf

However, after this i am facing error while verifying TensorFlow version.


import tensorflow as tf
print("TensorFlow version:", tf.__version__)
<ipython-input-3-9e8c16b8a701> in <module>
      1 import tensorflow as tf
----> 2 print("TensorFlow version:", tf.__version__)

AttributeError: module 'tensorflow' has no attribute '__version__'

Does this mean that installation is not successfull or perhaps it is broken?

I have seen solution here but to no avail.

Having multiple python versions can they create any conflicts preventing TensorFlow to run properly ?