WINDOWS10 Installing the TensorFlow GPU version (PIP3 installation method)

Source: Internet
Author: User
Tags stack trace

Objective:

TensorFlow has two versions of CPU and GPU: GPU version requires NVIDIA Cuda and CuDNN support, CPU version is not required; This article mainly installs the GPU version.


1. Environment
    • GPU: Verify that your video card supports CUDA, which is confirmed here.
    • VS2015 Runtime Library: Download 64-bit, download here, install after download.
    • Python 3.6/3.5: Download 64-bit, download here, install after download.
    • Pip 9.0.1 (confirm pip version >= 8.1, use pip-v to view the current PIP version, and upgrade Pip with python-m pip install-u pip. )

Note: Pip actually comes in when you install Python, but it needs to be (xxx:\ python\python36\scripts) is configured in the environment variable (path), the red font represents the path to the Python installation.

2. Installation

(1), download CUDA
Google official recommended CUDA8, can go to the official website download: Cuda

    • Cuda Installation

Directly double-click the EXE installation, follow the prompts to install the end of the line. After the test is installed, the command line enters Nvcc-v and the version information indicates that the installation was successful.

(2), download CUDNN

TensorFlow version different, the need for the CUDNN version is not the same, see TensorFlow release notes, such as: tensorflow1.3 Release Notes

    • Configure CUDNN
Download to the corresponding version of CUDNN (tensorflow1.3 need cuDNN6, can be downloaded to https://www.zhihu.com/question/37082272), unzip:
    1. The extracted bin directory is configured into the system environment variable (path);
    2. Copy the appropriate files to the appropriate directory:
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\

(3), installation TensorFlow

[HTML]View PlainCopy
    1. # GPU Version
    2. PIP3 Install--upgrade Tensorflow-gpu
    3. # CPU Version
    4. PIP3 Install--upgrade TensorFlow

(4), uninstall TensorFlow

[HTML]View PlainCopy
    1. PIP3 Uninstall TensorFlow
3. Testing [HTML]View PlainCopy
    1. Import TensorFlow as TF
    2. A = Tf.random_normal ((+))
    3. b = Tf.random_normal ((+, +))
    4. c = Tf.matmul (A, b)
    5. Sess = TF. InteractiveSession ()
    6. Sess.run (c)


Issue [HTML]View PlainCopy
  1. Traceback (most recent):
  2. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line +, in Swig_import_helper
  3. Return Importlib.import_module (Mname)
  4. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in Import_module
  5. Return _bootstrap._gcd_import (name[level:], package, level)
  6. File "<frozen Importlib._bootstrap>", line 986, in _gcd_import
  7. File "<frozen Importlib._bootstrap>", Line 969, in _find_and_load
  8. File "<frozen Importlib._bootstrap>", Line 958, in _find_and_load_unlocked
  9. File "<frozen Importlib._bootstrap>", Line 666, in _load_unlocked
  10. File "<frozen Importlib._bootstrap>", Line 577, in Module_from_spec
  11. File "<frozen importlib._bootstrap_external>", Line 906, in Create_module
  12. File "<frozen Importlib._bootstrap>", Line 222, in _call_with_frames_removed
  13. Importerror:dll load failed:the specified module could not be found.
  14. During handling of the above exception, another exception occurred:
  15. Traceback (most recent):
  16. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow.py ", line $, in <module>
  17. From tensorflow.python.pywrap_tensorflow_internal Import *
  18. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line +, in <module>
  19. _pywrap_tensorflow_internal = swig_import_helper ()
  20. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line A, in Swig_import_helper
  21. Return Importlib.import_module (' _pywrap_tensorflow_internal ')
  22. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in Import_module
  23. Return _bootstrap._gcd_import (name[level:], package, level)
  24. Importerror:no module named ' _pywrap_tensorflow_internal '
  25. During handling of the above exception, another exception occurred:
  26. Traceback (most recent):
  27. File "<pyshell#0>", Line 1, in <module>
  28. Import TensorFlow as TF
  29. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line +, in <module>
  30. From Tensorflow.python Import *
  31. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", Line Wuyi, in <module>
  32. From Tensorflow.python import Pywrap_tensorflow
  33. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow.py ", line-in <module>
  34. Raise Importerror (MSG)
  35. Importerror:traceback (most recent):
  36. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line +, in Swig_import_helper
  37. Return Importlib.import_module (Mname)
  38. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in Import_module
  39. Return _bootstrap._gcd_import (name[level:], package, level)
  40. File "<frozen Importlib._bootstrap>", line 986, in _gcd_import
  41. File "<frozen Importlib._bootstrap>", Line 969, in _find_and_load
  42. File "<frozen Importlib._bootstrap>", Line 958, in _find_and_load_unlocked
  43. File "<frozen Importlib._bootstrap>", Line 666, in _load_unlocked
  44. File "<frozen Importlib._bootstrap>", Line 577, in Module_from_spec
  45. File "<frozen importlib._bootstrap_external>", Line 906, in Create_module
  46. File "<frozen Importlib._bootstrap>", Line 222, in _call_with_frames_removed
  47. Importerror:dll load failed:the specified module could not be found.
  48. During handling of the above exception, another exception occurred:
  49. Traceback (most recent):
  50. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow.py ", line $, in <module>
  51. From tensorflow.python.pywrap_tensorflow_internal Import *
  52. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line +, in <module>
  53. _pywrap_tensorflow_internal = swig_import_helper ()
  54. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_ tensorflow_internal.py ", line A, in Swig_import_helper
  55. Return Importlib.import_module (' _pywrap_tensorflow_internal ')
  56. File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in Import_module
  57. Return _bootstrap._gcd_import (name[level:], package, level)
  58. Importerror:no module named ' _pywrap_tensorflow_internal '
  59. Failed to load the native TensorFlow runtime.
  60. See Https://www.tensorflow.org/install/install_sources#common_installation_problems
  61. For some common reasons and solutions. Include the entire stack trace
  62. Above this error message is asking for help.

If the Import TensorFlowWhen this problem occurs, it is most likely that the corresponding VS runtime library, such as tensorflow1.3, is not installed, and the runtime library that requires vs2015 is Visual C + + Redistributable for Visual Studio 2015

WINDOWS10 Installing the TensorFlow GPU version (PIP3 installation method)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.