ImportError: No module named 'tensorflow.core'

Issue

After installing tensorflow-gpu using pip3, I am getting the following error when trying to import tensorflow as tf

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dlpda/.local/lib/python3.5/site-packages/tensorflow/__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/dlpda/.local/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
ImportError: No module named 'tensorflow.core'

Although I am able to import successfully in a virtualenv, but not outside.

How should I resolve this problem to be able to import tensorflow?

Solution

The problem may be with packages installation directories like some packages are installed in home and some in /usr/.
I suggest you to remove all the packages in home directory by finding them in
~/.local/lib/python3.5/site-packages
and reinstall then with super user privileges.

Answered By – Shashikant Ghangare

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published