티스토리 뷰



[Tensorflow] windows 에 Tensorflow 설치하기 - CUDA GPU 

Windows 10 기준 텐서플로우 설치하기 


먼저 Python/Anaconda Windows 설치하기(http://dwfox.tistory.com/67)를 통해 3.5버전의 Python 설치 후 Tensorflow 설치 진행 할 것



  Tensorflow GPU 버전 - CUDA 설치하기

Tensorflow GUP 버전을 사용하기 위해서는 NVIDIA의 그래픽카드와 소프트웨어가 설치 되어 있어야 한다.


1. CUDA® Toolkit 8.0. 설치하기 

Cuda Toolkit 다운로드 [link] : https://developer.nvidia.com/cuda-downloads

컴퓨터 환경에 맞게 선택하고 다운로드 한다.


설치시 경로를 확인한다.

디폴트 경로는 아래와 같이 설정되어 있다.


설치 후 환경변수 편집을 통해

시스템 변수 Path에 경로 기준

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

2. cuDNN v5.1 설치하기 


cuDNN 5.1 다운로드 [link]https://developer.nvidia.com/cudnn

CuDNN은 NVIDIA에서 회원가입을 해야 다운 받을 수 있다.

간단하게 회원가입을 하고 다운을 받는다.




다운받은 파일은 기본경로 기준에 압축을 풀도록 한다.

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




  Tensorflow 설치


1. Tensorflow 설치 - Anaconda

C:\>python --version Python 3.5.2 :: Anaconda 4.2.0 (64-bit)


C:\>conda create -n tensorflow python=3.5


C:\>activate tensorflow


(tensorflow) C:\>


(tensorflow) C:\ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl



2. Tensorflow GPU - 테스트 결과

C:\>python Python 3.5.2 |Anaconda 4.2.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library nvcuda.dll locally I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library curand64_80.dll locally >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:885] Found device 0 with properties: name: GeForce GTX 960M major: 5 minor: 0 memoryClockRate (GHz) 1.176 pciBusID 0000:01:00.0 Total memory: 2.00GiB Free memory: 1.65GiB I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:906] DMA: 0 I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:916] 0: Y I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0) >>> print(sess.run(hello)) b'Hello, TensorFlow!'


참고 : https://www.tensorflow.org/install/install_windows

'Dev > ML' 카테고리의 다른 글

[Tensorflow] windows 에 Tensorflow 설치하기 - CUDA GPU  (5) 2018.07.13
댓글
  • 프로필사진 처음과끝 텐서플로우 까는것 까지는 되는데 계속 이런 메세지가 뜹니다. 조언을 부탁 드립니다.
    >>> import tensorflow as tf
    Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 985, in _gcd_import
    File "<frozen importlib._bootstrap>", line 968, in _find_and_load
    File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 577, in module_from_spec
    File "<frozen importlib._bootstrap_external>", line 938, in create_module
    File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
    ImportError: DLL load failed: 지정된 모듈을 찾을 수 없습니다.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ImportError: No module named '_pywrap_tensorflow_internal'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
    ImportError: Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 985, in _gcd_import
    File "<frozen importlib._bootstrap>", line 968, in _find_and_load
    File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 577, in module_from_spec
    File "<frozen importlib._bootstrap_external>", line 938, in create_module
    File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
    ImportError: DLL load failed: 지정된 모듈을 찾을 수 없습니다.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
    File "C:\Program Files\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ImportError: No module named '_pywrap_tensorflow_internal'


    Failed to load the native TensorFlow runtime.

    See https://www.tensorflow.org/install/install_sources#common_installation_problems

    for some common reasons and solutions. Include the entire stack trace
    above this error message when asking for help.
    2017.09.25 20:39
  • 프로필사진 deepMan 저도 같은 에러가ㅠㅠ 해결하면 댓글 올리겠습니다 2017.10.26 17:48
  • 프로필사진 deepMan 제가 파이썬 버전을 3.6 버전으로 환경 구축한 다음에
    pip install --ignore-installed --upgrade tensorflow-gpu
    요걸로 설치 했었는데

    3.5 버전으로 환경구축 다시하고
    블로그 글에 있는
    C:\ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.1-cp35-cp35m-win_amd64.whl
    요걸로 설치하니까 바로 되네요

    github에서도 원인을 찾아보니까
    보통 cuda 경로 설정 문제나
    vs 2015 재배포 update 3 설치 문제를 언급하시더라구여

    저는 cuda 경로 설정을
    https://github.com/bhavsarpratik/install_Tensorflow_Windows
    여기에 나와있는 것처럼 했구요
    vs 2015 재배포 update 3은 설치는 검색하면 금방 설치 할 수 있을 듯 합니다.

    파이썬 3.6을 무조건 써야하는 상황이 아니면 3.5로 환경 구축하는 것도 나쁘지 않을 것 같습니다.

    추가로 글쓴이님 감사합니다^^
    2017.10.26 18:26
  • 프로필사진 Ji deepMan 님 말대로 했는데도 안되네요ㅠㅜㅠㅠ 2018.12.05 19:31
  • 프로필사진 123 ㄴ 저도 이거랑 똑같은 에러 뜨네요 2017.10.18 19:40
댓글쓰기 폼