Some problems occured when trying to run tensorflow in an Anaconda environment using PyCharm

Completed

Recently I installed Anaconda on my new computer. When I tried to run Python code using tensorflow, errors occurred. I believe tensorflow in my virtual Anaconda environment was configured properly, because I could run the codes on Spyder.

I have searched on the Internet, they said what I need to do is to take C:\Users\username\AppData\Local\conda\conda\envs\tensorflow\python.exe as the project interpreter, which is what I used to do on my old computer where an old version of Anaconda was installed.

The way they told me worked well on my old computer with old Anaconda.

However, it seems that in the latest version of Anaconda, python.exe belonging to a virtual env is moved to #anaconda_installation_address\envs\envname, which in my case is C:\Users\Maple\anaconda\envs\tensorflow.

So I took C:\Users\vanta\anaconda\envs\tensorflow\python.exe as the project interpreter, but errors occurred. I am thinking maybe the issues are caused by new Anaconda.

Please help me fix it. Thanks

Error information is below:

Traceback (most recent call last):
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Onedrive/Study/Code/Python/tensortest/test.py", line 1, in <module>
import tensorflow as tf
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Maple\anaconda\envs\tensorflow\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。


Failed to load the native TensorFlow runtime.

0
2 comments

Hi 11712005,

There is a corresponding issue in our issue tracker https://youtrack.jetbrains.com/issue/PY-27234 and currently marked as In Progress, please follow it for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

1
Avatar
Permanently deleted user

Thanks! I hope this issue can be fixed soon.

0

Please sign in to leave a comment.