ZXY
ZXY

Reputation: 61

My ipython console in Spyder (Anaconda) is not picking up the correct windows's system PATH environment variables

First of all, the very original problem stemmed from me trying to install Tensorflow GPU.

To begin with I firstly through installing all the dependent packages (Nvidia GPU driver, CUDA, cudnn, etc), a fresh Anaconda package and tensorflow-gpu. All has been well so far.

Then I launched Spyden IDE and tried to run 'import tensorflow' in ipython. I then got this error:

Traceback (most recent call last):

  File "<ipython-input-1-d6579f534729>", line 1, in <module>
    import tensorflow

  File "C:\Users\zhengxin\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "C:\Users\zhengxin\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow

  File "C:\Users\zhengxin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)

ImportError: Traceback (most recent call last):
  File "C:\Users\zhengxin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\zhengxin\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\zhengxin\Anaconda3\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\zhengxin\Anaconda3\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\zhengxin\Anaconda3\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

I then went through a lot of research and found out that the most likely cause of this error is that the following two paths are NOT in the PATH environment variable displayed within Spyder (ipython).

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp

The very bizarre thing is, these two paths DO exist in my windows' system PATH environment variable.

So, finally, my question is, why is Spyder/ipython/anaconda not picking up the windows' PATH environment variables?

Upvotes: 1

Views: 749

Answers (1)

ZXY
ZXY

Reputation: 61

OK, I have resolved this problem myself.

The fact that the PATH environment variables are missing is a real thing, but it's in fact merely the symptom of a wrong dependency set-up of tensorflow-gpu.

Ultimately, the problem stemmed from me installing CUDA 10.0 and its accompanying cuDNN. Version 10.0 was the latest version on NVIDIA's website and it was such a natural mistake for people to make! Anyway, I then read through the release note of both CUDA and TensorFlow and determined I had to get CUDA 9.0 installed instead. And that worked!

Most amazingly and strangely, as soon as I've installed CUDA 9.0, all the environment variables suddenly became all correct! i.e. the path environment variables for all these four directories suddenly all, as if by magic, appear in my ipython/anaconda/spyder's PATH variables!

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp

Upvotes: 1

Related Questions