2
votes

After debugging, I found that below strange error

Program: (only 1 line) import tensorflow as tf

When I run above code first time, I got below warning: \AppData\Local\Continuum\anaconda3\lib\site-packages\h5py__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters

=> From web, this is just an warning and can ignore it ( i guess)

When I rerun the same code, I got below error

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile execfile(filename, namespace)

File "C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "H:/Python/Test/Test.py", line 15, in import tensorflow as tf

File "C:\Users\AppData\Roaming\Python\Python36\site-packages\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import

File "C:\Users\AppData\Roaming\Python\Python36\site-packages\tensorflow\python__init__.py", line 121, in from tensorflow.python.platform import test

File "C:\Users\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\platform\test.py", line 65, in tf_export('test.mock')(mock)

File "C:\Users\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\util\tf_export.py", line 96, in call (undecorated_func.name, undecorated_func._tf_api_names))

SymbolAlreadyExposedError: Symbol unittest.mock is already exposed as ('test.mock',).

Now I need to restart the kernel in order to run through the whole source code. Any idea ?

Thanks

1

1 Answers

2
votes

I tried this way and it worked (no more kernel restart is needed for further execution):

1/ Open the file test.py from this link:

"C:\Users\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\platform\test.py"

2/ Comment the line 65: #tf_export('test.mock')(mock)