Failed to load the native TensorFlow runtime. Python 3.5.2

前端 未结 8 1013
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-28 10:21

I\'m trying to install Tensorflow in my PC, i installed Python 3.5.2 64-bit, cuda_8.0.61 for windows 10 and cudnn-8.0-windows10-x64-v6.0

I used \"native\" pip to ins

相关标签:
8条回答
  • 2020-12-28 10:39

    I managed to run Tensorflow on Windows following these steps. Hope it helps! It may change depending in which folder you installed Python.

    1. Download and install Python 3.5.x
    2. Download and install Nvidia CUDA Toolkit
    3. Download CuDNN 5.1
    4. Copy CuDNN files to Nvidia CUDA toolkit folder when 2. has completed (usually is located on C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0)

      • copy cudnn\bin\cudnn64_5.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\
      • copy cudnn\include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\
      • copy cudnn\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64\
    5. Install Tensorflow via pip command prompt 'pip install --upgrade tensorflow-gpu'

      5.1 TensorFlow dependencies

      • make sure that Visual C++ Redistributate 2015 x64 is installed. If not, download it
      • move _curses_curses.cp35-win_amd64.pyd and _curses_panel.cp35-win_amd64.pyd to C:\Users\Username\AppData\Local\Programs\Python\Python35\Lib\site-packages (or you may need to download them as the next packages. just Ctrl+f for 'curses')
      • download and install these packages via pip (move to the directory where they were downloaded, open a command prompt and make 'pip install package_name')
        • numpy+mkl (http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
          • download numpy‑1.12.1+mkl‑cp35‑cp35m‑win_amd64.whl
          • pip install numpy‑1.12.1+mkl‑cp35‑cp35m‑win_amd64.whl
        • scipy (http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy)
          • download scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
          • pip install scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
      • open command prompt and make 'pip install matplotlib'
    0 讨论(0)
  • 2020-12-28 10:41

    Why don't try Anaconda?

    conda create -n gpu_env tensorflow-gpu
    conda activate gpu_env
    

    As easy as that. All the packages and runtime needed (Visual Studio included) will be brought together while you watch in awe :). Give it a try!

    Caveat: You need to run Keras from inside tensorflow in order for it to detect and use your GPU. Otherwise if you use just keras and tensorflow as a backend, Keras will use plain tensorflow and not tensorflow-gpu. Boths are installed side by side.

    Meaning you should code it this way:

    import tensorflow as tf
    from tensorflow.keras.models       import Sequential, load_model
    from tensorflow.keras.layers       import Dense,Dropout
    from tensorflow.keras.callbacks    import ModelCheckpoint, EarlyStopping,CSVLogger
    from tensorflow.keras.utils        import plot_model
    .............
    .............
    

    Hope this help.

    0 讨论(0)
  • 2020-12-28 10:50

    I have the same problem with you. The problem is that Anaconda automatically updates the python version when installing ipython and spyder, which becomes version 3.6. You can change the python version to version 3.5 by entering the tensorflow environment via Anaconda. enter image description here

    0 讨论(0)
  • 2020-12-28 10:50

    Everything could be installed from the console:

    conda create --name tf-gpu
    conda install -c aaronzs tensorflow-gpu
    conda install -c anaconda cudatoolkit
    conda install -c anaconda cudnn
    conda install keras-gpu
    
    0 讨论(0)
  • 2020-12-28 10:55

    If the problem persists check the version numbering and make sure cuda and TF are compatible.

    Check the version numbering here

    or for a simpler way, use Anaconda

    conda create --name new_env_name tensorflow-gpu
    activate new_env_name
    

    I successfully installed TensorFlow GPU version 1.12 (latest until the date of writing) with Cuda 9.0, GeForce 1050 Ti, Windows 10 and Python 3.6.7

    Note: You have installed the CUDA Toolkit (version 9) for TensorFlow to recognize your GPU

    0 讨论(0)
  • 2020-12-28 10:58

    Try:

    pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
    

    to install tensorflow instead of:

    pip install --upgrade tensorflow-gpu
    
    0 讨论(0)
提交回复
热议问题