본문 바로가기
컴퓨터.전자기기

윈도우 Tensorflow 환경 구축 (+GPU +Jupyter Notebook +GT1030)

by ㅋㅋ잠자 2018. 11. 18.
반응형

안녕하세요. 이번에 텐서플로우를 사용해 보는 시간이 있어서 정리해 보았습니다.



윈도우10 파워쉘을 기본으로 하고 있습니다.


이번 글에서는 윈도우를 기반으로 GPU 연동까지 알아보고, 그것을 원격지에서 코드를 돌려볼 수 있도록 주피터 노트북을 데몬모드로 돌려보는 것 까지 알아볼 생각입니다.


다음 글에서는 컨테이너 환경의 한계점에 대해서 알아보고, 리눅스에서는 어떻게 텐서플로를 사용하는지에 대한 방법에 대해서 알아볼 생각입니다.


-- 7분 만에 알아보는 텐서플로 GPU + GTX 1050TI on Windows






1. 파이썬 3.6 다운로드 및 설치


윈도우 스탠드얼론 실행파일을 받으시길 바랍니다.


현재 텐서플로우가 지원하는 파이썬 버전의 최상이 3.6임으로 3.6버전을 내려받아 줍니다.


https://www.python.org/downloads/release/python-360/


설치 과정상 환경변수에 추가해 주시고 꼭 문자열 제한을 해제해 주시길 바랍니다.





환경 변수에 등록하지 않으셨다면 직접 등록이 필요합니다. 아니면 바이너리가 있는 폴더로 이동하여 실행을 해야하는 귀찮음이 존재합니다. 환경 변수를 꼭 아래와 같이 설정하시길 바랍니다.


제어판 -> 시스템 -> 고급시스템 설정 -> 환경변수 에서 설정이 가능합니다.



특이하게도 윈도우 10 부터는 이렇게 리스트로 편집이 가능합니다 ㅎㅎ.. 이전 같은 경우에는 ; (세미콜론) 으로 분리하여 작성을 했었지요 ㅎㅎ


실제로 환경변수라는 말은 크게 의미가 있는지 잘 모르겠지만, 특정 폴더를 지정해 주면 쉘 스크립트 실행시에 바이너리 경로를 지정하지 않아도 실행이 가능합니다.


리눅스에서는 $PATH 변수에 저장이 되어 작동이 됩니다.





2. 환경 잘 작동하는지 체크하기


파워쉘을 엽니다. 혹시 모르니 관리자 권한으로 실행해 주시길 바랍니다.



먼저 파이썬 버전을 확인해 봅니다. 3.6버전으로 나오고 있습니다.



다음으로 PIP 패키지가 설치되어 있는지 확인해 봅니다. PIP 는 패키지를 설치하고 지우는 기능을 가지고 있습니다. 리눅스에서 apt-get 이나 yum 혹은 pacman 정도의 기능이 있다고 보시면 될것 같습니다.


PIP 버전이 9.01 버전이나 업그레이드를 하는 것이 텐서플로우 홈페이지에 나와 있습니다. 일단 저는 크게 문제가 없어서 업그레이드를 하지 않고 넘어가겠습니다.



한편, pip 나 virtualenv 나 pip 와 비슷한 easy_install 명령은 아래의 폴더에 위치해 있으며, 윈도우 바이너리로 컴파일이 되어 있습니다. 이전에 pip 를 실행하면 python pip 이런식으로 파이썬이 실행을 시켜주는 것으로 알았으나, 아예 바이너리화 되어 있네요.


--> 이 부분은 상당히 의문점이 남는 부분입니다.






3. virtualenv 설치하기 및 환경 생성 그리고 진입


virtualenv 는 경로를 격리시켜 버전별로 환경을 만들어 주는 것입니다. 가상환경이라고 말을 하기도 하지만, 실제로는 가상이라기 보다는 경로를 나누어 각각 다른 파이썬 버전과 혹은, 라이브러리를 설치할 수 있게 하는 것입니다.


시스템에 그냥 패키지를 설치하게 되면 그 버전의 패키지만 사용할 수 있게 되고, 의존성 문제가 생겨버릴 가능성이 커집니다. 프로젝트 단위별로 나누어 생성하고 그 프로젝트에 맞는 버전을 virtualenv 에 들어가셔서 설치 후 사용하시면 됩니다.


설치방법은, easy_install 혹은 pip 를 사용하시면 됩니다. 



그리고 제 작업 디렉토리 D:\tensorflow 를 생성하고 거기에 virtualenv 를 생성하겠습니다.


그러면 아래처럼 기본적으로 시스템 global 하게 설치된 패키지들이 virtualenv 로 들어가게 됩니다.



다음으로 환경을 활성화 해 보도록 하겠습니다.


환경을 활성화 하기 위해서 . .\----\Scripts\activate 를 해야하나, 기본적인 파워쉘의 보안 문제에 걸려버리네요.



그래서 보안 문제를 바이패스로 설정하고 진행해 보겠습니다.


아래처럼 set-executionpolicy bypass 를 입력하시고 Y 나 A 를 입력하시면 실행 규칙이 변경됩니다. 그리고 virtualenv 의 Srcipts 폴더에 activate.ps1 파일을 실행시키면 아래와 같이 쉘 앞에 (tensorflow) 라는 것이 붙게 됩니다.






4. tensorflow-gpu 설치하기 (일단 패키지만)


가상환경이 활성화 된 상태에서 아래의 명령을 입력합니다.


그러면 의존하고 있는 패키지들이 설치 됩니다.


(tensorflow) PS D:\> pip install tensorflow-gpu

Collecting tensorflow-gpu

  Downloading https://files.pythonhosted.org/packages/88/73/13e4071739df8d5ee7a27780d66bc98a51612521ad7e5a1e468d9507087c/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl (80.0MB)

    100% |████████████████████████████████| 80.0MB 153kB/s

Collecting termcolor>=1.1.0 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz

Collecting keras-preprocessing>=1.0.5 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl

Collecting absl-py>=0.1.6 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/0c/63/f505d2d4c21db849cf80bad517f0065a30be6b006b0a5637f1b95584a305/absl-py-0.6.1.tar.gz (94kB)

    100% |████████████████████████████████| 102kB 397kB/s

Requirement already satisfied: wheel>=0.26 in d:\tensorflow\lib\site-packages (from tensorflow-gpu) (0.32.2)

Collecting grpcio>=1.8.6 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/23/96/c98fb50c0cb693e3846ff4b9f39d09bc48b7302293c8ada3bf47c6467c58/grpcio-1.16.1-cp36-cp36m-win_amd64.whl (1.5MB)

    100% |████████████████████████████████| 1.5MB 562kB/s

Collecting keras-applications>=1.0.6 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl (44kB)

    100% |████████████████████████████████| 51kB 556kB/s

Collecting protobuf>=3.6.1 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/e8/df/d606d07cff0fc8d22abcc54006c0247002d11a7f2d218eb008d48e76851d/protobuf-3.6.1-cp36-cp36m-win_amd64.whl (1.1MB)

    100% |████████████████████████████████| 1.1MB 330kB/s

Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/e0/d0/65fe48383146199f16dbd5999ef226b87bce63ad5cd73c840cf722637969/tensorboard-1.12.0-py3-none-any.whl (3.0MB)

    100% |████████████████████████████████| 3.1MB 338kB/s

Collecting gast>=0.2.0 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz

Collecting six>=1.10.0 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl

Collecting numpy>=1.13.3 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/51/70/7096a735b27359dbc0c380b23b9c9bd05fea62233f95849c43a6b02c5f40/numpy-1.15.4-cp36-none-win_amd64.whl (13.5MB)

    100% |████████████████████████████████| 13.5MB 512kB/s

Collecting astor>=0.6.0 (from tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl

Collecting h5py (from keras-applications>=1.0.6->tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/12/6c/00c38c5ce9322f1cc421d93217c44739646a106c61859622eccc297a5c05/h5py-2.8.0-cp36-cp36m-win_amd64.whl (2.3MB)

    100% |████████████████████████████████| 2.3MB 469kB/s

Requirement already satisfied: setuptools in d:\tensorflow\lib\site-packages (from protobuf>=3.6.1->tensorflow-gpu) (40.6.2)

Collecting werkzeug>=0.11.10 (from tensorboard<1.13.0,>=1.12.0->tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)

    100% |████████████████████████████████| 327kB 193kB/s

Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow-gpu)

  Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)

    100% |████████████████████████████████| 92kB 368kB/s

Building wheels for collected packages: termcolor, absl-py, gast

  Running setup.py bdist_wheel for termcolor ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\7c\06\54\bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6

  Running setup.py bdist_wheel for absl-py ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\18\ea\5e\e36e1b8739e78cd2eba0a08fdc602c2b16a4b263912af8cb64

  Running setup.py bdist_wheel for gast ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\9a\1f\0e\3cde98113222b853e98fc0a8e9924480a3e25f1b4008cedb4f

Successfully built termcolor absl-py gast

Installing collected packages: termcolor, six, numpy, keras-preprocessing, absl-py, grpcio, h5py, keras-applications, protobuf, werkzeug, markdown, tensorboard, gast, astor, tensorflow-gpu

Successfully installed absl-py-0.6.1 astor-0.7.1 gast-0.2.0 grpcio-1.16.1 h5py-2.8.0 keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 numpy-1.15.4 protobuf-3.6.1 six-1.11.0 tensorboard-1.12.0 tensorflow-gpu-1.12.0 termcolor-1.1.0 werkzeug-0.14.1


CPU 버전을 설치하기 위해서는 tensorflow 만 입력하시면 됩니다.





5. 그래픽 카드 호환성 체크


일단 저는 하기의 시스템을 가지고 있습니다.


Intel Xeon E5 2665 8cores

16GB DDR3

Nvidia GT1030 2GB

Windows 10 RS4



일단 GPU 가 CUDA 연산을 지원하는지에 대한 정보를 보려면 아래의 사이트로 이동하시길 바랍니다.


https://developer.nvidia.com/cuda-gpus



와.. 지원목록에 GT1030 이 없습니다.. 1050TI 는 또 어디갔는지 모르겠습니다. 일단 목록이 상당히 오래되어 있는것 같습니다. 현재 텐서플로우에서는 CUDA 9.0 을 지원하고 있기 때문입니다.


그리고 지원 리스트에 없어도 작동이 되는 경우가 있기 때문에 일단은 무작정 설치를 진행해 봅니다.


GT 1030 의 경우 아래의 글을 참고해 보면 작동이 되는 것을 보실 수 있습니다. 완벽 지원이 안되는 듯한 느낌도 보이네요.


https://medium.com/@samnco/using-the-nvidia-gt-1030-for-cuda-workloads-on-ubuntu-16-04-4eee72d56791





6. 필요로 하는 파일 체크 및 설치


텐서플로우 홈페이지를 참고하면 아래의 파일들이 필요하다고 나옵니다.


https://www.tensorflow.org/install/gpu



1. 일단 그래픽 드라이버를 설치해 줍니다.


현재 드라이버가 몇버전인지 잘 모르겠습니다. 윈도우 업데이트를 통해 설치된 드라이버이기 때문에 많은 기능이 빠져 있을 확률이 매우 큽니다. 그래서 nvidia.com 에 들어가서 다운로드를 진행합니다.




버전이 416 버전이네요. 예전에 지포스 6200 사용할 때 버전이 90버전대였는데.. 이렇게 버전이 빨리 올라가는지 새삼 느끼게 되는 순간이였습니다.


드라이버는 그냥 다음다음 눌르시면서 설치하시면 됩니다. 굉장히 쉽습니다.


설치하실 때 지포스 게임 익스피리언스는 설치하지 않으셔도 됩니다. 드라이버만 설치하시길 바랍니다.


2. 쿠다 툴킷 설치하기


https://developer.nvidia.com/cuda-90-download-archive


텐서플로우에서 쿠다 9 버전을 지원한다고 하여서 꼭 9버전을 다운받으시길 바랍니다.



네트워크 인스톨러로 할 것인지 물어보는 부분이 있습니다만, 저는 음.. 로컬 설치를 권장드립니다. 한번에 받고 설치하는 것이 오래걸리지 않기 때문입니다.


한편, 패치 파일도 있습니다. 받으시길 바랍니다.



제발.. 제발... 제발... 호환된다고 떠라!




급한 마음에 드라이버 설치 후 재부팅을 하지 않았네요. ㅎㅎ 일단 재부팅 후 재시도 해봅니다.



일단 시스템 검사는 잘 넘어갔고 설치를 계속 진행해 봅니다.




중간에 특이하게도 그래픽 드라이버 설치 과정이 있습니다.



설치가 완료 되었습니다.



이어서 1234 순서대로 패치파일을 설치해 주시길 바랍니다.


3. 쿠다 DNN 설치하기 (가입 필요)


https://developer.nvidia.com/cudnn


받으실 때 마찬가지로 쿠다 9.0 에 맞는 버전을 받으셔야 합니다.



상기 파일을 풀어보면 아래와 같습니다.



상기 파일 그대로 모두 아래의 경로에 붙여넣어 덮어쓰기를 하시면 됩니다.




4. 환경 구축시 필요한 파일 목록



일단 여기서 필요로 하는 환경 구축은 끝났습니다.


리눅스 였으면 더욱 더 재미있게 가능하겠네요 ㅎㅎ.. GPU 환경과 CPU 환경의 속도 차이를 비교해보기 위한 다음 글로 넘어가겠습니다.





7. Web UI 로 편하게 테스트 해볼 수 있는 주피터 노트북 설치


아래 명령으로 설치합니다.


(tensorflow) PS D:\> pip install jupyter

Collecting jupyter

  Downloading https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl

Collecting ipywidgets (from jupyter)

  Downloading https://files.pythonhosted.org/packages/30/9a/a008c7b1183fac9e52066d80a379b3c64eab535bd9d86cdc29a0b766fd82/ipywidgets-7.4.2-py2.py3-none-any.whl (111kB)

    100% |████████████████████████████████| 112kB 127kB/s

Collecting qtconsole (from jupyter)

  Downloading https://files.pythonhosted.org/packages/e0/7a/8aefbc0ed078dec7951ac9a06dcd1869243ecd7bcbce26fa47bf5e469a8f/qtconsole-4.4.3-py2.py3-none-any.whl (113kB)

    100% |████████████████████████████████| 122kB 142kB/s

Collecting jupyter-console (from jupyter)

  Downloading https://files.pythonhosted.org/packages/cb/ee/6374ae8c21b7d0847f9c3722dcdfac986b8e54fa9ad9ea66e1eb6320d2b8/jupyter_console-6.0.0-py2.py3-none-any.whl

Collecting notebook (from jupyter)

  Downloading https://files.pythonhosted.org/packages/e1/d9/6d40b38c141dff656ba8b13684c20a97064ba868344da4aa8e94519b12ca/notebook-5.7.1-py2.py3-none-any.whl (9.0MB)

    100% |████████████████████████████████| 9.0MB 139kB/s

Collecting nbconvert (from jupyter)

  Downloading https://files.pythonhosted.org/packages/b5/bb/94c493051d60e5b9c0f7f9a368b324201818c1b1c4cae85d1e49a41846c7/nbconvert-5.4.0-py2.py3-none-any.whl (405kB)

    100% |████████████████████████████████| 409kB 124kB/s

Collecting ipykernel (from jupyter)

  Downloading https://files.pythonhosted.org/packages/d8/b0/f0be5c5ab335196f5cce96e5b889a4fcf5bfe462eb0acc05cd7e2caf65eb/ipykernel-5.1.0-py3-none-any.whl (113kB)

    100% |████████████████████████████████| 122kB 164kB/s

Collecting ipython>=4.0.0; python_version >= "3.3" (from ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/1b/e2/ffb8c1b574f972cf4183b0aac8f16b57f1e3bbe876b31555b107ea3fd009/ipython-7.1.1-py3-none-any.whl (764kB)

    100% |████████████████████████████████| 768kB 71kB/s

Collecting nbformat>=4.2.0 (from ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl (155kB)

    100% |████████████████████████████████| 163kB 128kB/s

Collecting traitlets>=4.3.1 (from ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl (74kB)

    100% |████████████████████████████████| 81kB 180kB/s

Collecting widgetsnbextension~=3.4.0 (from ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/8a/81/35789a3952afb48238289171728072d26d6e76649ddc8b3588657a2d78c1/widgetsnbextension-3.4.2-py2.py3-none-any.whl (2.2MB)

    100% |████████████████████████████████| 2.2MB 36kB/s

Collecting jupyter-client>=4.1 (from qtconsole->jupyter)

  Downloading https://files.pythonhosted.org/packages/94/dd/fe6c4d683b09eb05342bd2816b7779663f71762b4fa9c2d5203d35d17354/jupyter_client-5.2.3-py2.py3-none-any.whl (89kB)

    100% |████████████████████████████████| 92kB 33kB/s

Collecting jupyter-core (from qtconsole->jupyter)

  Downloading https://files.pythonhosted.org/packages/1d/44/065d2d7bae7bebc06f1dd70d23c36da8c50c0f08b4236716743d706762a8/jupyter_core-4.4.0-py2.py3-none-any.whl (126kB)

    100% |████████████████████████████████| 133kB 67kB/s

Collecting pygments (from qtconsole->jupyter)

  Downloading https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl (841kB)

    100% |████████████████████████████████| 849kB 89kB/s

Collecting ipython-genutils (from qtconsole->jupyter)

  Downloading https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl

Collecting prompt-toolkit<2.1.0,>=2.0.0 (from jupyter-console->jupyter)

  Downloading https://files.pythonhosted.org/packages/d1/e6/adb3be5576f5d27c6faa33f1e9fea8fe5dbd9351db12148de948507e352c/prompt_toolkit-2.0.7-py3-none-any.whl (338kB)

    100% |████████████████████████████████| 348kB 140kB/s

Collecting pyzmq>=17 (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/86/0b/c3583486820c01cb9c228708923004f380400ddb9064178772965067f689/pyzmq-17.1.2-cp36-cp36m-win_amd64.whl (991kB)

    100% |████████████████████████████████| 993kB 95kB/s

Collecting Send2Trash (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl

Collecting terminado>=0.8.1 (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/2e/20/a26211a24425923d46e1213b376a6ee60dc30bcdf1b0c345e2c3769deb1c/terminado-0.8.1-py2.py3-none-any.whl

Collecting tornado>=4 (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/ab/0e/8ec7ed219cb35fffe2f2cddbfa02b47ba5d23dd9026a41b3f2bdd63cdec3/tornado-5.1.1-cp36-cp36m-win_amd64.whl (455kB)

    100% |████████████████████████████████| 460kB 146kB/s

Collecting prometheus-client (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/61/84/9aa657b215b04f21a72ca8e50ff159eef9795096683e4581a357baf4dde6/prometheus_client-0.4.2.tar.gz

Collecting jinja2 (from notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)

    100% |████████████████████████████████| 133kB 190kB/s

Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/4c/ea/236e2584af67bb6df960832731a6e5325fd4441de001767da328c33368ce/pandocfilters-1.4.2.tar.gz

Collecting entrypoints>=0.2.2 (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/cc/8b/4eefa9b47f1910b3d2081da67726b066e379b04ca897acfe9f92bac56147/entrypoints-0.2.3-py2.py3-none-any.whl

Collecting testpath (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/be/a4/162f9ebb6489421fe46dcca2ae420369edfee4b563c668d93cb4605d12ba/testpath-0.4.2-py2.py3-none-any.whl (163kB)

    100% |████████████████████████████████| 163kB 127kB/s

Collecting mistune>=0.8.1 (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl

Collecting defusedxml (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl

Collecting bleach (from nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/d4/0d/4696373c3b714f6022d668fbab619690a42050dbeacede6d10ed97fbd3e2/bleach-3.0.2-py2.py3-none-any.whl (148kB)

    100% |████████████████████████████████| 153kB 225kB/s

Collecting backcall (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/84/71/c8ca4f5bb1e08401b916c68003acf0a0655df935d74d93bf3f3364b310e0/backcall-0.1.0.tar.gz

Collecting colorama; sys_platform == "win32" (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/0a/93/6e8289231675d561d476d656c2ee3a868c1cca207e16c118d4503b25e2bf/colorama-0.4.0-py2.py3-none-any.whl

Collecting decorator (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/bc/bb/a24838832ba35baf52f32ab1a49b906b5f82fb7c76b2f6a7e35e140bac30/decorator-4.3.0-py2.py3-none-any.whl

Requirement already satisfied: setuptools>=18.5 in d:\tensorflow\lib\site-packages (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter) (40.6.2)

Collecting jedi>=0.10 (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/7a/1a/9bd24a185873b998611c2d8d4fb15cd5e8a879ead36355df7ee53e9111bf/jedi-0.13.1-py2.py3-none-any.whl (177kB)

    100% |████████████████████████████████| 184kB 282kB/s

Collecting pickleshare (from ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl

Collecting jsonschema!=2.5.0,>=2.4 (from nbformat>=4.2.0->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl

Requirement already satisfied: six in d:\tensorflow\lib\site-packages (from traitlets>=4.3.1->ipywidgets->jupyter) (1.11.0)

Collecting python-dateutil>=2.1 (from jupyter-client>=4.1->qtconsole->jupyter)

  Downloading https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl (225kB)

    100% |████████████████████████████████| 235kB 281kB/s

Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->jupyter-console->jupyter)

  Downloading https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl

Collecting pywinpty>=0.5; os_name == "nt" (from terminado>=0.8.1->notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/96/b8/fe0669423dd6a7bbac22fb56bd8a740c674f22e90fd5ecb9ac6c68789a7b/pywinpty-0.5.4-cp36-cp36m-win_amd64.whl (1.3MB)

    100% |████████████████████████████████| 1.3MB 85kB/s

Collecting MarkupSafe>=0.23 (from jinja2->notebook->jupyter)

  Downloading https://files.pythonhosted.org/packages/9d/80/9a5daf3ed7b8482e72ee138cef602b538cfba5c507e24e39fb95c189b16b/MarkupSafe-1.1.0-cp36-cp36m-win_amd64.whl

Collecting webencodings (from bleach->nbconvert->jupyter)

  Downloading https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl

Collecting parso>=0.3.0 (from jedi>=0.10->ipython>=4.0.0; python_version >= "3.3"->ipywidgets->jupyter)

  Downloading https://files.pythonhosted.org/packages/09/51/9c48a46334be50c13d25a3afe55fa05c445699304c5ad32619de953a2305/parso-0.3.1-py2.py3-none-any.whl (88kB)

    100% |████████████████████████████████| 92kB 83kB/s

Building wheels for collected packages: prometheus-client, pandocfilters, backcall

  Running setup.py bdist_wheel for prometheus-client ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\b9\96\bc\e2acadc6bbfe57a1f631a34ca4ce6dd057af059b8d6878202b

  Running setup.py bdist_wheel for pandocfilters ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\39\01\56\f1b08a6275acc59e846fa4c1e1b65dbc1919f20157d9e66c20

  Running setup.py bdist_wheel for backcall ... done

  Stored in directory: C:\Users\USER\AppData\Local\pip\Cache\wheels\98\b0\dd\29e28ff615af3dda4c67cab719dd51357597eabff926976b45

Successfully built prometheus-client pandocfilters backcall

Installing collected packages: backcall, decorator, ipython-genutils, traitlets, colorama, parso, jedi, pygments, pickleshare, wcwidth, prompt-toolkit, ipython, jsonschema, jupyter-core, nbformat, tornado, pyzmq, python-dateutil, jupyter-client, ipykernel, Send2Trash, pywinpty, terminado, prometheus-client, pandocfilters, entrypoints, testpath, mistune, defusedxml, webencodings, bleach, MarkupSafe, jinja2, nbconvert, notebook, widgetsnbextension, ipywidgets, qtconsole, jupyter-console, jupyter

Successfully installed MarkupSafe-1.1.0 Send2Trash-1.5.0 backcall-0.1.0 bleach-3.0.2 colorama-0.4.0 decorator-4.3.0 defusedxml-0.5.0 entrypoints-0.2.3 ipykernel-5.1.0 ipython-7.1.1 ipython-genutils-0.2.0 ipywidgets-7.4.2 jedi-0.13.1 jinja2-2.10 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.2.3 jupyter-console-6.0.0 jupyter-core-4.4.0 mistune-0.8.4 nbconvert-5.4.0 nbformat-4.4.0 notebook-5.7.1 pandocfilters-1.4.2 parso-0.3.1 pickleshare-0.7.5 prometheus-client-0.4.2 prompt-toolkit-2.0.7 pygments-2.2.0 python-dateutil-2.7.5 pywinpty-0.5.4 pyzmq-17.1.2 qtconsole-4.4.3 terminado-0.8.1 testpath-0.4.2 tornado-5.1.1 traitlets-4.3.2 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.4.2

(tensorflow) PS D:\>


일단 기본 설정으로 돌려보겠습니다.


Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.


# 먼저 제 작업경로로 이동합니다.

PS C:\WINDOWS\system32> cd D:\


# virtualenv 환경을 활성화 합니다.

PS D:\> . .\tensorflow\Scripts\activate


# 주피터 노트북을 실행합니다.

(tensorflow) PS D:\> jupyter-notebook

[I 23:17:47.085 NotebookApp] Writing notebook server cookie secret to C:\Users\USER\AppData\Roaming\jupyter\runtime\notebook_cookie_secret

[I 23:17:51.330 NotebookApp] Serving notebooks from local directory: D:\

[I 23:17:51.330 NotebookApp] The Jupyter Notebook is running at:

[I 23:17:51.330 NotebookApp] http://localhost:8888/?token=cb7c54cd4a3be8bc510e86e541284317172495f4d475519a

[I 23:17:51.330 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 23:17:51.336 NotebookApp]


    Copy/paste this URL into your browser when you connect for the first time,

    to login with a token:

        http://localhost:8888/?token=cb7c54cd4a3be8bc510e86e541284317172495f4d475519a

[I 23:17:51.583 NotebookApp] Accepting one-time-token-authenticated connection from ::1


실행을 하고 나면 아래와 같이 웹 UI 가 실행이 됩니다. 실행이 되지 않는다면 상기 콘솔창에 나오는 주소를 직접 복사하여 붙여넣기 하시길 바랍니다.



음.. 교수님께서 올려주신 샘플코드를 돌려보니 일단 에러가 발생하고 있습니다.



그런데 이것만이 문제가 아니였습니다. 아예 tensorflow 모듈 임포트 부터 에러가 나고 있습니다. ㅎㅎ






8. 마음을 가다듬고.. 다시..


마음을 가다듬고.. 아래의 그림을 참고하며 가상환경을 날립니다. 다시 설치해 봅니다.



자.. 다시 가이드를 참고해서 설치를 새로 시도해 봅니다.


파이썬 3.6.7 버전을 설치해주고 다시 시도합니다.


https://www.python.org/downloads/release/python-367/


# pip 와 virtualenv 를 설치해 줍니다. -U 옵션은 크게 필요없습니다.

PS D:\> pip3 install -U pip virtualenv

Cache entry deserialization failed, entry ignored

Collecting pip

  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)

    100% |████████████████████████████████| 1.3MB 203kB/s

Requirement already up-to-date: virtualenv in c:\users\user\appdata\local\programs\python\python36\lib\site-packages

Installing collected packages: pip

  Found existing installation: pip 9.0.1

    Uninstalling pip-9.0.1:

      Successfully uninstalled pip-9.0.1


# 가상환경을 지워줍니다. 이게 가상환경을 이용하는 묘미 아니겠습니까?

PS D:\> rm .\tensorflow\


# 가상환경을 생성해 줍니다. 가이드대로 생성합니다.

PS D:\> virtualenv --system-site-packages -p python3 ./tensorflow

The path python3 (from --python=python3) does not exist


# python3 가 아닌 python 과 바인딩 되어 있음으로 python 으로 수정합니다.

PS D:\> virtualenv --system-site-packages -p python ./tensorflow

Running virtualenv with interpreter C:\Users\USER\AppData\Local\Programs\Python\Python36\python.exe

Using base prefix 'C:\\Users\\USER\\AppData\\Local\\Programs\\Python\\Python36'

New python executable in D:\tensorflow\Scripts\python.exe

Installing setuptools, pip, wheel...

done.

PS D:\>


# tensorflow-gpu 를 설치합니다. 가상환경에 들어와서 설치를 합니다. --upgrade 는 필요없습니다.

(tensorflow) PS D:\> pip install --upgrade tensorflow-gpu

Collecting tensorflow-gpu

  Using cached https://files.pythonhosted.org/packages/88/73/13e4071739df8d5ee7a27780d66bc98a51612521ad7e5a1e468d9507087c/tensorflow_gpu-1.12.0-cp36-cp36m-win_amd64.whl

Collecting protobuf>=3.6.1 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/e8/df/d606d07cff0fc8d22abcc54006c0247002d11a7f2d218eb008d48e76851d/protobuf-3.6.1-cp36-cp36m-win_amd64.whl

Collecting grpcio>=1.8.6 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/23/96/c98fb50c0cb693e3846ff4b9f39d09bc48b7302293c8ada3bf47c6467c58/grpcio-1.16.1-cp36-cp36m-win_amd64.whl

Collecting six>=1.10.0 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl

Collecting keras-preprocessing>=1.0.5 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl

Requirement already satisfied, skipping upgrade: wheel>=0.26 in d:\tensorflow\lib\site-packages (from tensorflow-gpu) (0.32.2)

Collecting absl-py>=0.1.6 (from tensorflow-gpu)

Collecting gast>=0.2.0 (from tensorflow-gpu)

Collecting numpy>=1.13.3 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/51/70/7096a735b27359dbc0c380b23b9c9bd05fea62233f95849c43a6b02c5f40/numpy-1.15.4-cp36-none-win_amd64.whl

Collecting termcolor>=1.1.0 (from tensorflow-gpu)

Collecting keras-applications>=1.0.6 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl

Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/e0/d0/65fe48383146199f16dbd5999ef226b87bce63ad5cd73c840cf722637969/tensorboard-1.12.0-py3-none-any.whl

Collecting astor>=0.6.0 (from tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl

Requirement already satisfied, skipping upgrade: setuptools in d:\tensorflow\lib\site-packages (from protobuf>=3.6.1->tensorflow-gpu) (40.6.2)

Collecting h5py (from keras-applications>=1.0.6->tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/12/6c/00c38c5ce9322f1cc421d93217c44739646a106c61859622eccc297a5c05/h5py-2.8.0-cp36-cp36m-win_amd64.whl

Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl

Collecting werkzeug>=0.11.10 (from tensorboard<1.13.0,>=1.12.0->tensorflow-gpu)

  Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl

Installing collected packages: six, protobuf, grpcio, numpy, keras-preprocessing, absl-py, gast, termcolor, h5py, keras-applications, markdown, werkzeug, tensorboard, astor, tensorflow-gpu

Successfully installed absl-py-0.6.1 astor-0.7.1 gast-0.2.0 grpcio-1.16.1 h5py-2.8.0 keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 numpy-1.15.4 protobuf-3.6.1 six-1.11.0 tensorboard-1.12.0 tensorflow-gpu-1.12.0 termcolor-1.1.0 werkzeug-0.14.1


# 테스트로 코드 돌려봅니다.

(tensorflow) PS D:\> python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_norm

al([1000, 1000])))"

2018-11-19 04:23:15.356689: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:

name: GeForce GT 1030 major: 6 minor: 1 memoryClockRate(GHz): 1.468

pciBusID: 0000:01:00.0

totalMemory: 2.00GiB freeMemory: 1.62GiB

2018-11-19 04:23:15.367811: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0




# 주피터 노트북 설치합니다.

(tensorflow) PS D:\> pip install --upgrade jupyter

Collecting jupyter

  Using cached https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl

Collecting notebook (from jupyter)

  Using cached https://files.pythonhosted.org/packages/a2/5d/d1907cd32ac00b5ead56f6e61d9794fa60ef105a22ac5da6e7556011580f/notebook-5.7.2-py2.py3-none-any.whl

Collecting nbconvert (from jupyter)

  Using cached https://files.pythonhosted.org/packages/b5/bb/94c493051d60e5b9c0f7f9a368b324201818c1b1c4cae85d1e49a41846c7/nbconvert-5.4.0-py2.py3-none-any.whl

Collecting jupyter-console (from jupyter)

  Using cached https://files.pythonhosted.org/packages/cb/ee/6374ae8c21b7d0847f9c3722dcdfac986b8e54fa9ad9ea66e1eb6320d2b8/jupyter_console-6.0.0-py2.py3-none-any.whl

Collecting ipykernel (from jupyter)

  Using cached https://files.pythonhosted.org/packages/d8/b0/f0be5c5ab335196f5cce96e5b889a4fcf5bfe462eb0acc05cd7e2caf65eb/ipykernel-5.1.0-py3-none-any.whl

Collecting qtconsole (from jupyter)

  Using cached https://files.pythonhosted.org/packages/e0/7a/8aefbc0ed078dec7951ac9a06dcd1869243ecd7bcbce26fa47bf5e469a8f/qtconsole-4.4.3-py2.py3-none-any.whl

Collecting ipywidgets (from jupyter)

  Using cached https://files.pythonhosted.org/packages/30/9a/a008c7b1183fac9e52066d80a379b3c64eab535bd9d86cdc29a0b766fd82/ipywidgets-7.4.2-py2.py3-none-any.whl

Collecting pyzmq>=17 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/86/0b/c3583486820c01cb9c228708923004f380400ddb9064178772965067f689/pyzmq-17.1.2-cp36-cp36m-win_amd64.whl

Collecting Send2Trash (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/49/46/c3dc27481d1cc57b9385aff41c474ceb7714f7935b1247194adae45db714/Send2Trash-1.5.0-py3-none-any.whl

Collecting ipython-genutils (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl

Collecting traitlets>=4.2.1 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl

Collecting jupyter-client>=5.2.0 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/94/dd/fe6c4d683b09eb05342bd2816b7779663f71762b4fa9c2d5203d35d17354/jupyter_client-5.2.3-py2.py3-none-any.whl

Collecting nbformat (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl

Collecting jinja2 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl

Collecting prometheus-client (from notebook->jupyter)

Collecting terminado>=0.8.1 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/2e/20/a26211a24425923d46e1213b376a6ee60dc30bcdf1b0c345e2c3769deb1c/terminado-0.8.1-py2.py3-none-any.whl

Collecting tornado>=4 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/ab/0e/8ec7ed219cb35fffe2f2cddbfa02b47ba5d23dd9026a41b3f2bdd63cdec3/tornado-5.1.1-cp36-cp36m-win_amd64.whl

Collecting jupyter-core>=4.4.0 (from notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/1d/44/065d2d7bae7bebc06f1dd70d23c36da8c50c0f08b4236716743d706762a8/jupyter_core-4.4.0-py2.py3-none-any.whl

Collecting entrypoints>=0.2.2 (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/cc/8b/4eefa9b47f1910b3d2081da67726b066e379b04ca897acfe9f92bac56147/entrypoints-0.2.3-py2.py3-none-any.whl

Collecting defusedxml (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/87/1c/17f3e3935a913dfe2a5ca85fa5ccbef366bfd82eb318b1f75dadbf0affca/defusedxml-0.5.0-py2.py3-none-any.whl

Collecting testpath (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/be/a4/162f9ebb6489421fe46dcca2ae420369edfee4b563c668d93cb4605d12ba/testpath-0.4.2-py2.py3-none-any.whl

Collecting mistune>=0.8.1 (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/09/ec/4b43dae793655b7d8a25f76119624350b4d65eb663459eb9603d7f1f0345/mistune-0.8.4-py2.py3-none-any.whl

Collecting pandocfilters>=1.4.1 (from nbconvert->jupyter)

Collecting bleach (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/d4/0d/4696373c3b714f6022d668fbab619690a42050dbeacede6d10ed97fbd3e2/bleach-3.0.2-py2.py3-none-any.whl

Collecting pygments (from nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/02/ee/b6e02dc6529e82b75bb06823ff7d005b141037cb1416b10c6f00fc419dca/Pygments-2.2.0-py2.py3-none-any.whl

Collecting prompt-toolkit<2.1.0,>=2.0.0 (from jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/d1/e6/adb3be5576f5d27c6faa33f1e9fea8fe5dbd9351db12148de948507e352c/prompt_toolkit-2.0.7-py3-none-any.whl

Collecting ipython (from jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/1b/e2/ffb8c1b574f972cf4183b0aac8f16b57f1e3bbe876b31555b107ea3fd009/ipython-7.1.1-py3-none-any.whl

Collecting widgetsnbextension~=3.4.0 (from ipywidgets->jupyter)

  Using cached https://files.pythonhosted.org/packages/8a/81/35789a3952afb48238289171728072d26d6e76649ddc8b3588657a2d78c1/widgetsnbextension-3.4.2-py2.py3-none-any.whl

Requirement already satisfied, skipping upgrade: six in d:\tensorflow\lib\site-packages (from traitlets>=4.2.1->notebook->jupyter) (1.11.0)

Collecting decorator (from traitlets>=4.2.1->notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/bc/bb/a24838832ba35baf52f32ab1a49b906b5f82fb7c76b2f6a7e35e140bac30/decorator-4.3.0-py2.py3-none-any.whl

Collecting python-dateutil>=2.1 (from jupyter-client>=5.2.0->notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl

Collecting jsonschema!=2.5.0,>=2.4 (from nbformat->notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl

Collecting MarkupSafe>=0.23 (from jinja2->notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/9d/80/9a5daf3ed7b8482e72ee138cef602b538cfba5c507e24e39fb95c189b16b/MarkupSafe-1.1.0-cp36-cp36m-win_amd64.whl

Collecting pywinpty>=0.5; os_name == "nt" (from terminado>=0.8.1->notebook->jupyter)

  Using cached https://files.pythonhosted.org/packages/96/b8/fe0669423dd6a7bbac22fb56bd8a740c674f22e90fd5ecb9ac6c68789a7b/pywinpty-0.5.4-cp36-cp36m-win_amd64.whl

Collecting webencodings (from bleach->nbconvert->jupyter)

  Using cached https://files.pythonhosted.org/packages/f4/24/2a3e3df732393fed8b3ebf2ec078f05546de641fe1b667ee316ec1dcf3b7/webencodings-0.5.1-py2.py3-none-any.whl

Collecting wcwidth (from prompt-toolkit<2.1.0,>=2.0.0->jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl

Requirement already satisfied, skipping upgrade: setuptools>=18.5 in d:\tensorflow\lib\site-packages (from ipython->jupyter-console->jupyter) (40.6.2)

Collecting backcall (from ipython->jupyter-console->jupyter)

Collecting colorama; sys_platform == "win32" (from ipython->jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/0a/93/6e8289231675d561d476d656c2ee3a868c1cca207e16c118d4503b25e2bf/colorama-0.4.0-py2.py3-none-any.whl

Collecting pickleshare (from ipython->jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/9a/41/220f49aaea88bc6fa6cba8d05ecf24676326156c23b991e80b3f2fc24c77/pickleshare-0.7.5-py2.py3-none-any.whl

Collecting jedi>=0.10 (from ipython->jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/7a/1a/9bd24a185873b998611c2d8d4fb15cd5e8a879ead36355df7ee53e9111bf/jedi-0.13.1-py2.py3-none-any.whl

Collecting parso>=0.3.0 (from jedi>=0.10->ipython->jupyter-console->jupyter)

  Using cached https://files.pythonhosted.org/packages/09/51/9c48a46334be50c13d25a3afe55fa05c445699304c5ad32619de953a2305/parso-0.3.1-py2.py3-none-any.whl

Installing collected packages: pyzmq, Send2Trash, ipython-genutils, decorator, traitlets, python-dateutil, jupyter-core, tornado, jupyter-client, jsonschema, nbformat, entrypoints, defusedxml, testpath, MarkupSafe, jinja2, mistune, pandocfilters, webencodings, bleach, pygments, nbconvert, prometheus-client, wcwidth, prompt-toolkit, backcall, colorama, pickleshare, parso, jedi, ipython, ipykernel, pywinpty, terminado, notebook, jupyter-console, qtconsole, widgetsnbextension, ipywidgets, jupyter

Successfully installed MarkupSafe-1.1.0 Send2Trash-1.5.0 backcall-0.1.0 bleach-3.0.2 colorama-0.4.0 decorator-4.3.0 defusedxml-0.5.0 entrypoints-0.2.3 ipykernel-5.1.0 ipython-7.1.1 ipython-genutils-0.2.0 ipywidgets-7.4.2 jedi-0.13.1 jinja2-2.10 jsonschema-2.6.0 jupyter-1.0.0 jupyter-client-5.2.3 jupyter-console-6.0.0 jupyter-core-4.4.0 mistune-0.8.4 nbconvert-5.4.0 nbformat-4.4.0 notebook-5.7.2 pandocfilters-1.4.2 parso-0.3.1 pickleshare-0.7.5 prometheus-client-0.4.2 prompt-toolkit-2.0.7 pygments-2.2.0 python-dateutil-2.7.5 pywinpty-0.5.4 pyzmq-17.1.2 qtconsole-4.4.3 terminado-0.8.1 testpath-0.4.2 tornado-5.1.1 traitlets-4.3.2 wcwidth-0.1.7 webencodings-0.5.1 widgetsnbextension-3.4.2


(tensorflow) PS D:\> jupyter notebook

[I 04:31:52.572 NotebookApp] Serving notebooks from local directory: D:\

[I 04:31:52.572 NotebookApp] The Jupyter Notebook is running at:

[I 04:31:52.573 NotebookApp] http://localhost:8888/?token=67d3a29142709bca2a68990f28225f92083040a39b760b07

[I 04:31:52.575 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 04:31:52.582 NotebookApp]


    Copy/paste this URL into your browser when you connect for the first time,

    to login with a token:

        http://localhost:8888/?token=67d3a29142709bca2a68990f28225f92083040a39b760b07

[I 04:31:52.821 NotebookApp] Accepting one-time-token-authenticated connection from ::1




# 실행 하는 중간에 matpotlib 가 없다는 에러가 있습니다.

(tensorflow) PS D:\> jupyter notebook

[I 04:31:52.572 NotebookApp] Serving notebooks from local directory: D:\

[I 04:31:52.572 NotebookApp] The Jupyter Notebook is running at:

[I 04:31:52.573 NotebookApp] http://localhost:8888/?token=67d3a29142709bca2a68990f28225f92083040a39b760b07

[I 04:31:52.575 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 04:31:52.582 NotebookApp]


    Copy/paste this URL into your browser when you connect for the first time,

    to login with a token:

        http://localhost:8888/?token=67d3a29142709bca2a68990f28225f92083040a39b760b07

[I 04:31:52.821 NotebookApp] Accepting one-time-token-authenticated connection from ::1

[I 04:32:46.511 NotebookApp] Kernel started: f4d7012f-c427-4507-bbba-86c74e70b89c

[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?

[I 04:32:47.568 NotebookApp] Adapting to protocol v5.1 for kernel f4d7012f-c427-4507-bbba-86c74e70b89c

[I 04:33:07.401 NotebookApp] Starting buffering for f4d7012f-c427-4507-bbba-86c74e70b89c:aeb9c46d5ed54e6f89d76af93f3f2754

[I 04:33:07.617 NotebookApp] Kernel restarted: f4d7012f-c427-4507-bbba-86c74e70b89c

[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?

[I 04:33:08.679 NotebookApp] Adapting to protocol v5.1 for kernel f4d7012f-c427-4507-bbba-86c74e70b89c

[I 04:33:08.680 NotebookApp] Restoring connection for f4d7012f-c427-4507-bbba-86c74e70b89c:aeb9c46d5ed54e6f89d76af93f3f2754

[I 04:33:08.681 NotebookApp] Replaying 3 buffered messages

[I 04:33:16.616 NotebookApp] Interrupted...

[I 04:33:16.616 NotebookApp] Shutting down 1 kernel

[I 04:33:17.021 NotebookApp] Kernel shutdown: f4d7012f-c427-4507-bbba-86c74e70b89c


# 설치해 줍니다.

(tensorflow) PS D:\> pip install matplotlib

Collecting matplotlib

  Using cached https://files.pythonhosted.org/packages/b1/56/569c83515c10146fd0aa09e086816b12e301d0811048e3354a6e9b77ba9a/matplotlib-3.0.2-cp36-cp36m-win_amd64.whl

Collecting kiwisolver>=1.0.1 (from matplotlib)

  Using cached https://files.pythonhosted.org/packages/44/72/16630c3392eba03788ad87949390516bbc488e8e118047a3b824631d21a6/kiwisolver-1.0.1-cp36-none-win_amd64.whl

Requirement already satisfied: python-dateutil>=2.1 in d:\tensorflow\lib\site-packages (from matplotlib) (2.7.5)

Collecting cycler>=0.10 (from matplotlib)

  Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl

Requirement already satisfied: numpy>=1.10.0 in d:\tensorflow\lib\site-packages (from matplotlib) (1.15.4)

Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)

  Using cached https://files.pythonhosted.org/packages/71/e8/6777f6624681c8b9701a8a0a5654f3eb56919a01a78e12bf3c73f5a3c714/pyparsing-2.3.0-py2.py3-none-any.whl

Requirement already satisfied: setuptools in d:\tensorflow\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (40.6.2)

Requirement already satisfied: six>=1.5 in d:\tensorflow\lib\site-packages (from python-dateutil>=2.1->matplotlib) (1.11.0)

Installing collected packages: kiwisolver, cycler, pyparsing, matplotlib

Successfully installed cycler-0.10.0 kiwisolver-1.0.1 matplotlib-3.0.2 pyparsing-2.3.0


샘플 코드를 돌려봅니다.


이제 에러가 발생하지 않네요.. ㅎㅎㅎ !!!! 파이썬 3.6.0 버전의 에러인것 같습니다.



로그에도 보면 GPU 가 등록되어 사용되고 있습니다.


(tensorflow) PS D:\> jupyter notebook

[I 04:33:51.527 NotebookApp] Serving notebooks from local directory: D:\

[I 04:33:51.528 NotebookApp] The Jupyter Notebook is running at:

[I 04:33:51.529 NotebookApp] http://localhost:8888/?token=78abad769bbc1fe98969c0a19188c1eac656ccdfe96ec65c

[I 04:33:51.531 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 04:33:51.538 NotebookApp]


    Copy/paste this URL into your browser when you connect for the first time,

    to login with a token:

        http://localhost:8888/?token=78abad769bbc1fe98969c0a19188c1eac656ccdfe96ec65c

[I 04:33:51.752 NotebookApp] Accepting one-time-token-authenticated connection from ::1

[W 04:33:53.958 NotebookApp] 404 GET /api/kernels/f4d7012f-c427-4507-bbba-86c74e70b89c/channels?session_id=aeb9c46d5ed54e6f89d76af93f3f2754 (::1): Kernel does not exist: f4d7012f-c427-4507-bbba-86c74e70b89c

[W 04:33:53.967 NotebookApp] 404 GET /api/kernels/f4d7012f-c427-4507-bbba-86c74e70b89c/channels?session_id=aeb9c46d5ed54e6f89d76af93f3f2754 (::1) 19.99ms referer=None

[I 04:34:03.699 NotebookApp] Kernel started: a2becc4c-c3b0-44f1-807d-8b70a99db408

[I 04:34:05.198 NotebookApp] Adapting to protocol v5.1 for kernel a2becc4c-c3b0-44f1-807d-8b70a99db408

2018-11-19 04:34:23.227699: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:

name: GeForce GT 1030 major: 6 minor: 1 memoryClockRate(GHz): 1.468

pciBusID: 0000:01:00.0

totalMemory: 2.00GiB freeMemory: 1.62GiB

2018-11-19 04:34:23.238918: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0

2018-11-19 04:34:24.342329: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:

2018-11-19 04:34:24.348343: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0

2018-11-19 04:34:24.352648: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N

2018-11-19 04:34:24.356662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1365 MB memory) -> physical GPU (device: 0, name: GeForce GT 1030, pci bus id: 0000:01:00.0, compute capability: 6.1)

[W 04:34:26.952 NotebookApp] Replacing stale connection: f4d7012f-c427-4507-bbba-86c74e70b89c:aeb9c46d5ed54e6f89d76af93f3f2754

[I 04:34:46.958 NotebookApp] Saving file at /다운로드/TensorflowDeeplearning-master/Chapter01/Least squares example.ipynb



세상 올라가지 않던 Compute 항목의 퍼센트가 올라갑니다. ㅎㅎㅎ



오케이!! 정상 실행값을 얻을 수 있었습니다.






9. 문제 해결 과정


1. DLL 로드를 실패한다.. 

--> 혹시 몰라서 쿠다 라이브러리 모두 환경변수에 추가해 주었습니다.

--> 리눅스가 세상 편한것 같습니다. ㅠㅠ




2. 파이썬 모듈 임포트시 필요 모듈 체크

--> Process Monitor 를 통해서 python 바이너리 실행 상황 체크

--> 별다른 부분은 없었습니다.


3. 파이썬 버전 3.6.0 에서 3.6.7 로 업글

--> 해결!!!





10. 주피터 노트북 데몬모드 실행 (원격 코딩)


# 기본 설정파일 생성

(tensorflow-gpu) PS C:\Users\USER\Downloads> jupyter notebook --generate-config

Writing default config to: C:\Users\USER\.jupyter\jupyter_notebook_config.py


# 기본 패스워드 설정

(tensorflow-gpu) PS C:\Users\USER\Downloads> jupyter notebook password

Enter password:

Verify password:


[NotebookPasswordApp] Wrote hashed password to C:\Users\USER\.jupyter\jupyter_notebook_config.json


# 8080포트 및 바인딩 ALL Address 로 실행

(tensorflow-gpu) PS C:\Users\USER\Downloads> jupyter notebook --port=8080 --no-browser -

-ip=0.0.0.0

[I 08:29:42.565 NotebookApp] Serving notebooks from local directory: C:\Users\USER\Downloads

[I 08:29:42.565 NotebookApp] The Jupyter Notebook is running at:

[I 08:29:42.568 NotebookApp] http://(DESKTOP-VNPFOTS or 127.0.0.1):8080/

[I 08:29:42.568 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[I 08:30:10.300 NotebookApp] 302 GET / (192.168.0.250) 0.00ms

[I 08:30:10.307 NotebookApp] 302 GET /tree? (192.168.0.250) 0.99ms

[W 08:30:12.385 NotebookApp] 401 POST /login?next=%2Ftree%3F (192.168.0.250) 1.99ms referer=http://192.168.0.250:8080/login?next=%2Ftree%3F

[W 08:30:14.472 NotebookApp] 401 POST /login?next=%2Ftree%3F (192.168.0.250) 2.01ms referer=http://192.168.0.250:8080/login?next=%2Ftree%3F

[W 08:30:16.862 NotebookApp] 401 POST /login?next=%2Ftree%3F (192.168.0.250) 2.00ms referer=http://192.168.0.250:8080/login?next=%2Ftree%3F

[I 08:30:35.886 NotebookApp] 302 POST /login?next=%2Ftree%3F (192.168.0.250) 1.02ms


상기 처럼 실행이 가능하고, SSL 인증을 사용하실 수 있습니다만, 저는 일단 내부는 http 로, proxy 단에서 https 를 넣는 편이라 일단 http 모드로 설정을 해 보았습니다.


하기와 같이 사용이 가능합니다. 


지정하신 포트를 포트포워딩 해 주시고 사용하시면 되겠습니다.



감사합니다.


다음에는 리눅스 환경에서 그리고 컨테이너 환경에서 다뤄보고 opencl 연동에 대해서 알아보도록 하겠습니다.

반응형

댓글