pyCharm - Conda environment issue with tensorflow

Answered

I have created a virtual environment via anaconda, when i activate it from command prompt, and then run 'import tensorflow as tf' it works fine, but when i try do the same via either pyCharm (interpreter is pointing to the correct environment's python.exe) or when i try to run same command in envs/env_name/python.exe it fails with same error

Working via cmd (screen 1)

 

Error in environment's python.exe (screen 2)

 

Error in pyCahrm (screen 3, same error)

I am using windows 10. please could you elaborate what exactly activate env_name do ? and how to resolve this issue ?

-------------------------------------------------

Error in imp.py

ImportError: DLL load failed: The specified module could not be found.

Failed to load the native TensorFlow runtime.

3 comments

Hi! As you can see from my post it is not only conda. I'm sure it is the same problem. So, please, vote for my post, because I posted earlier.

0

Hi,

In fact, this problem is only Conda specific. 

The problem is caused by known issue https://youtrack.jetbrains.com/issue/PY-27234. It should be fixed in 2019.1 version. We have realised our EAP build which has a fix for it. Would you mind give it a try?

You can download it from https://www.jetbrains.com/pycharm/nextversion/

 

Please note, that you can have multiple PyCharm installations at the same time. So you don't need to uninstall current stable version to install EAP build.

0

kudos! thanks a lot Sergey Karpov! steps below helped as a workaround, which was mentioned in 

 https://youtrack.jetbrains.com/issue/PY-27234

  • run import os in the system terminal using the same interpreter
  • run print(os.environ['PATH'])
  • copy the result and add as PATH environment variable to your Run/Debug Configuration
  • do the same for Python Console settings to get it working too.
0

Please sign in to leave a comment.