python - Error when importing tensorflow in Spyder -
i installed tensorflow on new laptop.
(anaconda 4.3.24, python 3.6.1, tensorflow: 1.2.1, gpu: nvidia 1060 6gb)
four problems currently.
{1} "failed load native tensorflow runtime" error in spyder
file "d:/programs/codes-python/opencvtest.py", line 13, in <module> import tensorflow tf file "d:\programs\anaconda\lib\site-packages\tensorflow\__init__.py", line 24, in <module> tensorflow.python import * file "d:\programs\anaconda\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> tensorflow.python import pywrap_tensorflow file "d:\programs\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module> raise importerror(msg) importerror: traceback (most recent call last): file "d:\programs\anaconda\lib\site- packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) file "d:\programs\anaconda\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) file "<frozen importlib._bootstrap>", line 978, in _gcd_import file "<frozen importlib._bootstrap>", line 961, in _find_and_load file "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked file "<frozen importlib._bootstrap>", line 648, in _load_unlocked file "<frozen importlib._bootstrap>", line 560, in module_from_spec file "<frozen importlib._bootstrap_external>", line 922, in create_module file "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed importerror: dll load failed: specified module not found. during handling of above exception, exception occurred: traceback (most recent call last): file "d:\programs\anaconda\lib\site- packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> tensorflow.python.pywrap_tensorflow_internal import * file "d:\programs\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> _pywrap_tensorflow_internal = swig_import_helper() file "d:\programs\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper return importlib.import_module('_pywrap_tensorflow_internal') file "d:\programs\anaconda\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) modulenotfounderror: no module named '_pywrap_tensorflow_internal' failed load native tensorflow runtime.
{2} ...but tensorflow loads without (much) problem command prompt
the confusing thing when load tensorflow via anaconda prompt -> activate tensorflow -> python -> import tensorflow: there no error while importing tensorflow.
how come? if tensorflow library installed environment error message in spyder should "no module named tensorflow"....
{3} discrepancies when running example
now when run test code in anaconda prompt:
>>> import tensorflow tf >>> hello = tf.constant('hello, tensorflow!') >>> sess = tf.session()
i following 'errors'?
2017-08-14 23:39:37.137745: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use sse instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.137929: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use sse2 instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.139157: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use sse3 instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.139677: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use sse4.1 instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.140599: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use sse4.2 instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.141239: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use avx instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.141915: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use avx2 instructions, these available on machine , speed cpu computations. 2017-08-14 23:39:37.142529: w c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] tensorflow library wasn't compiled use fma instructions, these available on machine , speed cpu computations.
but can still run last part of test "print(sess.run(hello))" , following result.
>>> print(sess.run(hello)) b'hello, tensorflow!'
the 'b' in front of hello not supposed there, present when run code. why?
{4} no known device error - gpu unrecognised? lastly, when check device being used, tensorflow not seem recognise gpu. why? i've tried uninstalling, re-installing tensorflow , tensorflow-gpu separately no avail.
>>> sess = tf.session(config = tf.configproto(log_device_placement=true)) device mapping: no known devices. 2017-08-14 23:50:42.624086: c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\common_runtime\direct_session.cc:265] device mapping:
any appreciated. thanks, cn
for {1} question, because activate tensorflow in {2}, guess spyder installed in different enviroment. maybe try change python interpreter of spyder preference->console->advanced settings. {4}, did install nvidia cuda tool? hope help.
best, robin
Comments
Post a Comment