0
votes

I get the following error when trying to use tensorflow

importError Traceback (most recent call last) in () ----> 1 import tensorflow as tf

~\Anaconda3\lib\site-packages\tensorflow__init__.py in () 22 23 # pylint: disable=wildcard-import ---> 24 from tensorflow.python import * 25 # pylint: enable=wildcard-import 26

~\Anaconda3\lib\site-packages\tensorflow\python__init__.py in () 54 # imported using tf.load_op_library() can access symbols defined in 55 # _pywrap_tensorflow.so. ---> 56 import numpy as np 57 try: 58 if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'):

~\Anaconda3\lib\site-packages\numpy__init__.py in () 140 return loader(*packages, **options) 141 --> 142 from . import add_newdocs 143 all = ['add_newdocs', 144 'ModuleDeprecationWarning',

~\Anaconda3\lib\site-packages\numpy\add_newdocs.py in () 11 from future import division, absolute_import, print_function 12 ---> 13 from numpy.lib import add_newdoc 14 15 ###############################################################################

~\Anaconda3\lib\site-packages\numpy\lib__init__.py in () 6 from numpy.version import version as version 7 ----> 8 from .type_check import * 9 from .index_tricks import * 10 from .function_base import *

~\Anaconda3\lib\site-packages\numpy\lib\type_check.py in () 9 'common_type'] 10 ---> 11 import numpy.core.numeric as _nx 12 from numpy.core.numeric import asarray, asanyarray, array, isnan, zeros 13 from .ufunclike import isneginf, isposinf

~\Anaconda3\lib\site-packages\numpy\core__init__.py in () 36 from . import numerictypes as nt 37 multiarray.set_typeDict(nt.sctypeDict) ---> 38 from . import numeric 39 from .numeric import * 40 from . import fromnumeric

~\Anaconda3\lib\site-packages\numpy\core\numeric.py in ()
1818 1819 # Use numarray's printing function -> 1820 from .arrayprint import array2string, get_printoptions, set_printoptions 1821 1822

~\Anaconda3\lib\site-packages\numpy\core\arrayprint.py in () 42 from .umath import absolute, not_equal, isnan, isinf, isfinite, isnat 43 from . import multiarray ---> 44 from .multiarray import (array, dragon4_positional, dragon4_scientific, 45 datetime_as_string, datetime_data, dtype, ndarray, 46 set_legacy_print_mode)

This error occured after I tried to upgrade TF from version 1.1 to the latest version. So I dont know what current TF version I am using. I am using Windows 10 without a GPU.

Do you know how to fix it?

2
What are your imports? What version of Tensorflow are you using? What OS? GPU or non-GPU?Yserbius
I edited my questionuser2505650

2 Answers

0
votes

This looks like it is an issue with Numpy, which is a dependency of Tensorflow. Did you try upgrading your version of numpy using pip or conda?

Like such: pip install --ignore-installed --upgrade numpy

-1
votes

your numpy has been corrupted. probably pip install and conda install wont work here to install numpy again. try if it helps, otherwise use follow these:

download zip file of numpy from https://pypi.org/project/numpy/#files
extract the numpy folder from the zip file
copy and paste the numpy folder at: C:/ProgramData/Anaconda3/Lib/site-packages/