I am having a very weird issue, I just had tensorflow working on my machine yesterday and now today I can't get it to import to save my life. Here is the error I'm getting.
import tensorflow
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
File "<ipython-input-1-d6579f534729>", line 1, in <module>
import tensorflow
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\__init__.py", line 46, in <module>
from tensorflow.python import distribute
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\distribute\__init__.py", line 28, in <module>
from tensorflow.python.distribute.experimental import collective_all_reduce_strategy
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\distribute\experimental\__init__.py", line 25, in <module>
from tensorflow.python.distribute import tpu_strategy
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\distribute\tpu_strategy.py", line 43, in <module>
from tensorflow.python.tpu import tpu
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\tpu\tpu.py", line 28, in <module>
from tensorflow.python.compiler.xla import xla
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\compiler\xla\__init__.py", line 23, in <module>
from tensorflow.python.compiler.xla import xla
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\compiler\xla\xla.py", line 25, in <module>
from tensorflow.compiler.jit.ops import xla_ops
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\compiler\jit\ops\xla_ops.py", line 9, in <module>
from tensorflow.python import pywrap_tfe as pywrap_tfe
ImportError: cannot import name 'pywrap_tfe' from 'tensorflow.python' (C:\Users\User\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\__init__.py)
After getting this the first time I decided to completely uninstall and reinstall tensorflow, which I did the two below commands in cmd.
pip uninstall tensorflow
pip install tensorflow
These seemed to execute without issue, but when I went back to spyder and tried to import tensorflow again, I got the same answer. I then did pip uninstall tensorflow again, and tried reinstalling with conda.
conda install tensorflow-gpu
After restarting my spyder kernel and attempting an import again I got the exact same result. I have been looking at several threads. The following two I have done and still am having no luck.
Error running basic tensorflow example
One other that I found but don't understand the recommended fix is this one: https://github.com/tensorflow/tensorflow/issues/3217
It discusses not running the script in the same directory you installed in, but I don't understand how that would relate to me running in spyder. Any help on this is greatly appreciated as I've already wasted a good half day trying to solve it.