딥러닝 툴 설치하기 Anaconda, Jupyter Notebook, TensorFlow and Keras for Deep Learning
딥러닝 학습을 위해 필요한 아나콘다, 주피터 노트북, 텐서플로우와 케라스를 설치해보자.
Downlaod Anaconda
먼저 아나콘다를 설치한다. 아나콘다 가상환경에 데이터 사이언스와 딥러닝에 필요한 패키지를 설치한다. 아나콘다를 사용하면 특정 프로젝트에 필요한 특정 버전의 패키지 설치 등 버전 충돌에 대한 우려를 덜 수 있는 장점이 있다. 다음과 같이 현재 기준으로 텐서플로우나 케라스가 지원하는 파이썬 3.6 버전을 갖춘 환경을 설치해보자.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54  | founder@hilbert:~$ conda create --name tfKeras python=3.6 Solving environment: done ## Package Plan ##   environment location: /home/founder/anaconda3/envs/tfKeras   added / updated specs:     - python=3.6 The following packages will be downloaded:     package                    |            build     ---------------------------|-----------------     pip-18.1                   |           py36_0         1.8 MB     setuptools-40.6.2          |           py36_0         604 KB     python-3.6.7               |       h0371630_0        34.3 MB     wheel-0.32.3               |           py36_0          35 KB     certifi-2018.11.29         |           py36_0         146 KB     ------------------------------------------------------------                                            Total:        36.9 MB The following NEW packages will be INSTALLED:     ca-certificates: 2018.03.07-0     certifi:         2018.11.29-py36_0     libedit:         3.1.20170329-h6b74fdf_2     libffi:          3.2.1-hd88cf55_4     libgcc-ng:       8.2.0-hdf63c60_1     libstdcxx-ng:    8.2.0-hdf63c60_1     ncurses:         6.1-he6710b0_1     openssl:         1.1.1a-h7b6447c_0     pip:             18.1-py36_0     python:          3.6.7-h0371630_0     readline:        7.0-h7b6447c_5     setuptools:      40.6.2-py36_0     sqlite:          3.25.3-h7b6447c_0     tk:              8.6.8-hbc83047_0     wheel:           0.32.3-py36_0     xz:              5.2.4-h14c3975_4     zlib:            1.2.11-h7b6447c_3 Proceed ([y]/n)? y Downloading and Extracting Packages pip-18.1             | 1.8 MB    | ##################################### | 100% setuptools-40.6.2    | 604 KB    | ##################################### | 100% python-3.6.7         | 34.3 MB   | ##################################### | 100% wheel-0.32.3         | 35 KB     | ################################################################################################## | 100% certifi-2018.11.29   | 146 KB    | ################################################################################################## | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # #     $ conda activate tfKeras # # To deactivate an active environment, use # #     $ conda deactivate founder@hilbert:~$ conda activate tfKeras (tfKeras) founder@hilbert:~$  | cs | 
Conda는 가상 환경을 관리하고 패키지를 설치해주는 패키지 매니저로, conda 를 이용하여 아래와 같은 명령을 실행할 수 있다.
# update conda in your default environment
$conda upgrade conda
$ conda upgrade --all
# create a new environment with conda
$ conda create -n [my-env-name]
# activate the environment you created
$ source activate [my-env-name]
# take a look at the environment you created
$ conda info
$ conda list
# install a package with conda and verify it's installed
$ conda install numpy
$ conda list
# take a look at the list of environments you currently have
$ conda info -e
# remove an environment
$ conda env remove --name [my-env-name]
특히 아나콘다는 Anaconda Cheatsheet 라는 매우 유용 문서를 제공하고 있으니 꼭 참고하길 바란다.
Source — https://conda.io/docs/_downloads/conda-cheatsheet.pdf
Conda vs Pip install
Conda 를 사용해 생성한 가상환경에서 패키지 설치는 conda 및 pip 둘 다 사용이 가능하지만, 아래와 같은 차이점이 있다.
- conda install - 모든 패키지 설치 가능
 - pip install - 파이썬 패키지 설치 가능, 사실상 파이썬 패키지 매니저
 
pip 와 conda 는 서로 다른 패키징 포맷을 사용하므로 상호교차하여 운영할 수 없다. 그리고 conda list 를 이용하여 설치된 패키지를 확인할 수 있으며, conda 또는 pip 중 무엇을 이용하여 설치했는지도 확인할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  | (tfKeras) founder@hilbert:~$ conda list # packages in environment at /home/founder/anaconda3/envs/tfKeras: # # Name                    Version                   Build  Channel ca-certificates           2018.03.07                    0 certifi                   2018.11.29               py36_0 Keras                     2.2.4                     <pip> libedit                   3.1.20170329         h6b74fdf_2 libffi                    3.2.1                hd88cf55_4 libgcc-ng                 8.2.0                hdf63c60_1 libstdcxx-ng              8.2.0                hdf63c60_1 ncurses                   6.1                  he6710b0_1 openssl                   1.1.1a               h7b6447c_0 pip                       18.1                     py36_0 python                    3.6.7                h0371630_0 PyYAML                    3.13                      <pip> readline                  7.0                  h7b6447c_5 scipy                     1.1.0                     <pip> setuptools                40.6.2                   py36_0 sqlite                    3.25.3               h7b6447c_0 tk                        8.6.8                hbc83047_0 wheel                     0.32.3                   py36_0 xz                        5.2.4                h14c3975_4 zlib                      1.2.11               h7b6447c_3  | cs | 
Install TensorFlow (including Keras)
앞서 conda 로 생성한 가상 환경에 TenslowFlow 를 설치합니다. TensorFlow 공식 설치가이드에 따라 conda install 이 아닌 pip install 을 사용하자. 아래 링크를 참고한다.
https://www.tensorflow.org/install/pip
각각 하나의 패키지를 설치할 수도 있고, reuqirements.txt 파일로부터 다수의 패키지를 한 번에 설치할 수도 있다.
먼저 해당 시스템의 파이썬 개발환경이 셋팅되어있는지 확인한다. python 과 pip 가 설치되어 있는지 확인하고 없다면 설치한다.
1 2 3 4 5  | (tfKeras) founder@hilbert:~$ python3 --version Python 3.6.7 :: Anaconda, Inc. (tfKeras) founder@hilbert:~$ pip3 --version pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)  | cs | 
텐서플로우를 설치한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61  | (tfKeras) founder@hilbert:~$ pip3 install --upgrade tensorflow Collecting tensorflow   Cache entry deserialization failed, entry ignored   Downloading https://files.pythonhosted.org/packages/22/cc/ca70b78087015d21c5f3f93694107f34ebccb3be9624385a911d4b52ecef/tensorflow-1.12.0-cp36-cp36m-manylinux1_x86_64.whl (83.1MB)     100% |████████████████████████████████| 83.1MB 13kB/s Collecting keras-applications>=1.0.6 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl (44kB)     100% |████████████████████████████████| 51kB 9.4MB/s Collecting gast>=0.2.0 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/5c/78/ff794fcae2ce8aa6323e789d1f8b3b7765f601e7702726f430e814822b96/gast-0.2.0.tar.gz Collecting six>=1.10.0 (from tensorflow)   Cache entry deserialization failed, entry ignored   Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl Collecting grpcio>=1.8.6 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/3b/bb/701d879849c938028c09fdb5405dbde7c86644bbbb90098094002db23ded/grpcio-1.17.1-cp36-cp36m-manylinux1_x86_64.whl (10.1MB)     100% |████████████████████████████████| 10.1MB 131kB/s Collecting astor>=0.6.0 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl Collecting termcolor>=1.1.0 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz Collecting absl-py>=0.1.6 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/0c/63/f505d2d4c21db849cf80bad517f0065a30be6b006b0a5637f1b95584a305/absl-py-0.6.1.tar.gz (94kB)     100% |████████████████████████████████| 102kB 10.1MB/s Collecting numpy>=1.13.3 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/ff/7f/9d804d2348471c67a7d8b5f84f9bc59fd1cefa148986f2b74552f8573555/numpy-1.15.4-cp36-cp36m-manylinux1_x86_64.whl (13.9MB)     100% |████████████████████████████████| 13.9MB 95kB/s Collecting protobuf>=3.6.1 (from tensorflow)   Cache entry deserialization failed, entry ignored   Downloading https://files.pythonhosted.org/packages/c2/f9/28787754923612ca9bfdffc588daa05580ed70698add063a5629d1a4209d/protobuf-3.6.1-cp36-cp36m-manylinux1_x86_64.whl (1.1MB)     100% |████████████████████████████████| 1.1MB 1.1MB/s Collecting wheel>=0.26 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl Collecting tensorboard<1.13.0,>=1.12.0 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/e0/d0/65fe48383146199f16dbd5999ef226b87bce63ad5cd73c840cf722637969/tensorboard-1.12.0-py3-none-any.whl (3.0MB)     100% |████████████████████████████████| 3.1MB 443kB/s Collecting keras-preprocessing>=1.0.5 (from tensorflow)   Downloading https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl Collecting h5py (from keras-applications>=1.0.6->tensorflow)   Downloading https://files.pythonhosted.org/packages/8e/cb/726134109e7bd71d98d1fcc717ffe051767aac42ede0e7326fd1787e5d64/h5py-2.8.0-cp36-cp36m-manylinux1_x86_64.whl (2.8MB)     100% |████████████████████████████████| 2.8MB 460kB/s Collecting setuptools (from protobuf>=3.6.1->tensorflow)   Cache entry deserialization failed, entry ignored   Downloading https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl (573kB)     100% |████████████████████████████████| 573kB 2.0MB/s Collecting markdown>=2.6.8 (from tensorboard<1.13.0,>=1.12.0->tensorflow)   Downloading https://files.pythonhosted.org/packages/7a/6b/5600647404ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287/Markdown-3.0.1-py2.py3-none-any.whl (89kB)     100% |████████████████████████████████| 92kB 10.1MB/s Collecting werkzeug>=0.11.10 (from tensorboard<1.13.0,>=1.12.0->tensorflow)   Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)     100% |████████████████████████████████| 327kB 3.9MB/s Building wheels for collected packages: gast, termcolor, absl-py   Running setup.py bdist_wheel for gast ... done   Stored in directory: /home/founder/.cache/pip/wheels/9a/1f/0e/3cde98113222b853e98fc0a8e9924480a3e25f1b4008cedb4f   Running setup.py bdist_wheel for termcolor ... done   Stored in directory: /home/founder/.cache/pip/wheels/7c/06/54/bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6   Running setup.py bdist_wheel for absl-py ... done   Stored in directory: /home/founder/.cache/pip/wheels/18/ea/5e/e36e1b8739e78cd2eba0a08fdc602c2b16a4b263912af8cb64 Successfully built gast termcolor absl-py Installing collected packages: six, numpy, h5py, keras-applications, gast, grpcio, astor, termcolor, absl-py, setuptools, protobuf, wheel, markdown, werkzeug, tensorboard, keras-preprocessing, tensorflow Successfully installed absl-py-0.6.1 astor-0.7.1 gast-0.2.0 grpcio-1.17.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 setuptools-40.6.3 six-1.12.0 tensorboard-1.12.0 tensorflow-1.12.0 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.32.3  | cs | 
텐서플로우가 제대로 설치되었는지 확인해보자. 1.12.0 버전이 설치되었음을 확인할 수 있다.
1 2  | (tfKeras) founder@hilbert:~$ python3 -c 'import tensorflow as tf; print(tf.__version__)' 1.12.0  | cs | 
다음으로 케라스를 설치한다. 반드시 텐서플로우 설치 후에 진행한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  | (tfKeras) founder@hilbert:~$ pip install Keras Collecting Keras   Downloading https://files.pythonhosted.org/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl (312kB)     100% |████████████████████████████████| 317kB 21.6MB/s Collecting pyyaml (from Keras)   Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)     100% |████████████████████████████████| 276kB 23.4MB/s Requirement already satisfied: six>=1.9.0 in ./.local/lib/python3.6/site-packages (from Keras) (1.12.0) Collecting scipy>=0.14 (from Keras)   Downloading https://files.pythonhosted.org/packages/a8/0b/f163da98d3a01b3e0ef1cab8dd2123c34aee2bafbb1c5bffa354cc8a1730/scipy-1.1.0-cp36-cp36m-manylinux1_x86_64.whl (31.2MB)     100% |████████████████████████████████| 31.2MB 966kB/s Requirement already satisfied: keras-preprocessing>=1.0.5 in ./.local/lib/python3.6/site-packages (from Keras) (1.0.5) Requirement already satisfied: keras-applications>=1.0.6 in ./.local/lib/python3.6/site-packages (from Keras) (1.0.6) Requirement already satisfied: numpy>=1.9.1 in ./.local/lib/python3.6/site-packages (from Keras) (1.15.4) Requirement already satisfied: h5py in ./.local/lib/python3.6/site-packages (from Keras) (2.8.0) Building wheels for collected packages: pyyaml   Running setup.py bdist_wheel for pyyaml ... done   Stored in directory: /home/founder/.cache/pip/wheels/ad/da/0c/74eb680767247273e2cf2723482cb9c924fe70af57c334513f Successfully built pyyaml Installing collected packages: pyyaml, scipy, Keras Successfully installed Keras-2.2.4 pyyaml-3.13 scipy-1.1.0  | cs | 
케라스 설치 여부를 확인하자. 파이썬 셀은 Ctrl+D 로 빠져나온다.
1 2 3 4 5 6 7 8 9  | (tfKeras) founder@hilbert:~$ python Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:16:44) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import keras Using TensorFlow backend. kera>>> keras.__version__ '2.2.4'  | cs | 
Launch Jupyter Notebook
주피터 노트북은 데이터 분석과 시각화에 필수적인 툴이다. 여기서는 원격지에 실행시킨 노트북 환경을 웹에서 구동할 있도록 다음과 같이 노트북 서버를 구동한다.
1 2 3 4 5 6 7 8  | (tfKeras) founder@hilbert:~$ jupyter notebook --no-browser --ip=0.0.0.0 [W 10:03:48.891 NotebookApp] All authentication is disabled.  Anyone who can connect to this server will be able to run code. [I 10:03:48.922 NotebookApp] JupyterLab extension loaded from /home/founder/anaconda3/lib/python3.7/site-packages/jupyterlab [I 10:03:48.923 NotebookApp] JupyterLab application directory is /home/founder/anaconda3/share/jupyter/lab [I 10:03:48.926 NotebookApp] Serving notebooks from local directory: /home/founder [I 10:03:48.927 NotebookApp] The Jupyter Notebook is running at: [I 10:03:48.927 NotebookApp] http://(hilbert or 127.0.0.1):8888/ [I 10:03:48.927 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).  | cs | 
노트북이 가동된 모습이다.
아래는 Jupyter Notebook Cheat Sheet 이다. 다음 링크에서 다운로드 가능하다.
https://s3.amazonaws.com/assets.datacamp.com/blog_assets/Jupyter_Notebook_Cheat_Sheet.pdf
설치된 노트북 작동 여부를 확인해보자. New > Python3 노트북을 만들고, 텐서플로우 버전을 확인하는 코드를 넣는다. 하지만 앞서 파이썬 셀에서는 정상적으로 작동하던 내용이 노트북에서는 다음과 같이 해당 모듈을 찾을 수 없다고 나온다.
import tensorflow as tf
print ("TensorFlow version: " + tf.__version__)
이 경우 하단 링크를 참고해 에러를 해결한다. 별도 설치없이 노트북이 실행되어 이 부분 고민을 하지 않았을텐데 이 때 실행된 노트북은 기본 환경의 글로벌 주피터인셈이다. conda 환경에서 주피터를 설치해서 오버라이딩 해야한다.
https://stackoverflow.com/questions/38221181/no-module-named-tensorflow-in-jupyter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181  | (tfKeras) founder@hilbert:~$ conda install jupyter notebook Solving environment: done ## Package Plan ##   environment location: /home/founder/anaconda3/envs/tfKeras   added / updated specs:     - jupyter     - notebook The following packages will be downloaded:     package                    |            build     ---------------------------|-----------------     ptyprocess-0.6.0           |           py36_0          23 KB     notebook-5.7.2             |           py36_0         7.2 MB     pyqt-5.9.2                 |   py36h05f1152_2         5.6 MB     qt-5.9.7                   |       h5867ecd_1        85.9 MB     pandoc-2.2.3.2             |                0        20.8 MB     pexpect-4.6.0              |           py36_0          77 KB     jupyter_client-5.2.3       |           py36_0         124 KB     bleach-3.0.2               |           py36_0         220 KB     pandocfilters-1.4.2        |           py36_1          13 KB     wcwidth-0.1.7              |           py36_0          25 KB     ipywidgets-7.4.2           |           py36_0         151 KB     entrypoints-0.2.3          |           py36_2           9 KB     markupsafe-1.1.0           |   py36h7b6447c_0          26 KB     nbconvert-5.3.1            |           py36_0         406 KB     pickleshare-0.7.5          |           py36_0          13 KB     testpath-0.4.2             |           py36_0          91 KB     terminado-0.8.1            |           py36_1          21 KB     qtconsole-4.4.3            |           py36_0         157 KB     decorator-4.3.0            |           py36_0          15 KB     ipython-7.2.0              |   py36h39e3cac_0         1.0 MB     ipython_genutils-0.2.0     |           py36_0          39 KB     mistune-0.8.4              |   py36h7b6447c_0          54 KB     traitlets-4.3.2            |           py36_0         133 KB     nbformat-4.4.0             |           py36_0         141 KB     ipykernel-5.1.0            |   py36h39e3cac_0         156 KB     prompt_toolkit-2.0.7       |           py36_0         482 KB     tornado-5.1.1              |   py36h7b6447c_0         663 KB     python-dateutil-2.7.5      |           py36_0         275 KB     six-1.12.0                 |           py36_0          22 KB     jupyter-1.0.0              |           py36_7           6 KB     parso-0.3.1                |           py36_0         114 KB     pyzmq-17.1.2               |   py36h14c3975_0         454 KB     jupyter_core-4.4.0         |           py36_0          63 KB     pygments-2.2.0             |           py36_0         1.3 MB     jedi-0.13.1                |           py36_0         229 KB     widgetsnbextension-3.4.2   |           py36_0         1.7 MB     prometheus_client-0.4.2    |           py36_0          64 KB     sip-4.19.8                 |   py36hf484d3e_0         290 KB     webencodings-0.5.1         |           py36_1          19 KB     jupyter_console-6.0.0      |           py36_0          35 KB     jsonschema-2.6.0           |           py36_0          62 KB     libpng-1.6.35              |       hbc83047_0         335 KB     jinja2-2.10                |           py36_0         184 KB     backcall-0.1.0             |           py36_0          19 KB     send2trash-1.5.0           |           py36_0          16 KB     ------------------------------------------------------------                                            Total:       128.6 MB The following NEW packages will be INSTALLED:     backcall:           0.1.0-py36_0     bleach:             3.0.2-py36_0     dbus:               1.13.2-h714fa37_1     decorator:          4.3.0-py36_0     entrypoints:        0.2.3-py36_2     expat:              2.2.6-he6710b0_0     fontconfig:         2.13.0-h9420a91_0     freetype:           2.9.1-h8a8886c_1     glib:               2.56.2-hd408876_0     gmp:                6.1.2-h6c8ec71_1     gst-plugins-base:   1.14.0-hbbd80ab_1     gstreamer:          1.14.0-hb453b48_1     icu:                58.2-h9c2bf20_1     ipykernel:          5.1.0-py36h39e3cac_0     ipython:            7.2.0-py36h39e3cac_0     ipython_genutils:   0.2.0-py36_0     ipywidgets:         7.4.2-py36_0     jedi:               0.13.1-py36_0     jinja2:             2.10-py36_0     jpeg:               9b-h024ee3a_2     jsonschema:         2.6.0-py36_0     jupyter:            1.0.0-py36_7     jupyter_client:     5.2.3-py36_0     jupyter_console:    6.0.0-py36_0     jupyter_core:       4.4.0-py36_0     libpng:             1.6.35-hbc83047_0     libsodium:          1.0.16-h1bed415_0     libuuid:            1.0.3-h1bed415_2     libxcb:             1.13-h1bed415_1     libxml2:            2.9.8-h26e45fe_1     markupsafe:         1.1.0-py36h7b6447c_0     mistune:            0.8.4-py36h7b6447c_0     nbconvert:          5.3.1-py36_0     nbformat:           4.4.0-py36_0     notebook:           5.7.2-py36_0     pandoc:             2.2.3.2-0     pandocfilters:      1.4.2-py36_1     parso:              0.3.1-py36_0     pcre:               8.42-h439df22_0     pexpect:            4.6.0-py36_0     pickleshare:        0.7.5-py36_0     prometheus_client:  0.4.2-py36_0     prompt_toolkit:     2.0.7-py36_0     ptyprocess:         0.6.0-py36_0     pygments:           2.2.0-py36_0     pyqt:               5.9.2-py36h05f1152_2     python-dateutil:    2.7.5-py36_0     pyzmq:              17.1.2-py36h14c3975_0     qt:                 5.9.7-h5867ecd_1     qtconsole:          4.4.3-py36_0     send2trash:         1.5.0-py36_0     sip:                4.19.8-py36hf484d3e_0     six:                1.12.0-py36_0     terminado:          0.8.1-py36_1     testpath:           0.4.2-py36_0     tornado:            5.1.1-py36h7b6447c_0     traitlets:          4.3.2-py36_0     wcwidth:            0.1.7-py36_0     webencodings:       0.5.1-py36_1     widgetsnbextension: 3.4.2-py36_0     zeromq:             4.2.5-hf484d3e_1 Proceed ([y]/n)? y Downloading and Extracting Packages ptyprocess-0.6.0     | 23 KB     | ################################################################################################## | 100% notebook-5.7.2       | 7.2 MB    | ################################################################################################## | 100% pyqt-5.9.2           | 5.6 MB    | ################################################################################################## | 100% qt-5.9.7             | 85.9 MB   | ################################################################################################## | 100% pandoc-2.2.3.2       | 20.8 MB   | ################################################################################################## | 100% pexpect-4.6.0        | 77 KB     | ################################################################################################## | 100% jupyter_client-5.2.3 | 124 KB    | ################################################################################################## | 100% bleach-3.0.2         | 220 KB    | ################################################################################################## | 100% pandocfilters-1.4.2  | 13 KB     | ################################################################################################## | 100% wcwidth-0.1.7        | 25 KB     | ################################################################################################## | 100% ipywidgets-7.4.2     | 151 KB    | ################################################################################################## | 100% entrypoints-0.2.3    | 9 KB      | ################################################################################################## | 100% markupsafe-1.1.0     | 26 KB     | ################################################################################################## | 100% nbconvert-5.3.1      | 406 KB    | ################################################################################################## | 100% pickleshare-0.7.5    | 13 KB     | ################################################################################################## | 100% testpath-0.4.2       | 91 KB     | ################################################################################################## | 100% terminado-0.8.1      | 21 KB     | ################################################################################################## | 100% qtconsole-4.4.3      | 157 KB    | ################################################################################################## | 100% decorator-4.3.0      | 15 KB     | ################################################################################################## | 100% ipython-7.2.0        | 1.0 MB    | ################################################################################################## | 100% ipython_genutils-0.2 | 39 KB     | ################################################################################################## | 100% mistune-0.8.4        | 54 KB     | ################################################################################################## | 100% traitlets-4.3.2      | 133 KB    | ################################################################################################## | 100% nbformat-4.4.0       | 141 KB    | ################################################################################################## | 100% ipykernel-5.1.0      | 156 KB    | ################################################################################################## | 100% prompt_toolkit-2.0.7 | 482 KB    | ################################################################################################## | 100% tornado-5.1.1        | 663 KB    | ################################################################################################## | 100% python-dateutil-2.7. | 275 KB    | ################################################################################################## | 100% six-1.12.0           | 22 KB     | ################################################################################################## | 100% jupyter-1.0.0        | 6 KB      | ################################################################################################## | 100% parso-0.3.1          | 114 KB    | ################################################################################################## | 100% pyzmq-17.1.2         | 454 KB    | ################################################################################################## | 100% jupyter_core-4.4.0   | 63 KB     | ################################################################################################## | 100% pygments-2.2.0       | 1.3 MB    | ################################################################################################## | 100% jedi-0.13.1          | 229 KB    | ################################################################################################## | 100% widgetsnbextension-3 | 1.7 MB    | ################################################################################################## | 100% prometheus_client-0. | 64 KB     | ################################################################################################## | 100% sip-4.19.8           | 290 KB    | ################################################################################################## | 100% webencodings-0.5.1   | 19 KB     | ################################################################################################## | 100% jupyter_console-6.0. | 35 KB     | ################################################################################################## | 100% jsonschema-2.6.0     | 62 KB     | ################################################################################################## | 100% libpng-1.6.35        | 335 KB    | ################################################################################################## | 100% jinja2-2.10          | 184 KB    | ################################################################################################## | 100% backcall-0.1.0       | 19 KB     | ################################################################################################## | 100% send2trash-1.5.0     | 16 KB     | ################################################################################################## | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done  | cs | 
conda list 를 실행해보면 패키지 목록에 주피터가 들어간 것을 확인할 수 있다. 앞서 실행했을 때는 이 패키지가 존재하지 않았다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86  | (tfKeras) founder@hilbert:~$ conda list # packages in environment at /home/founder/anaconda3/envs/tfKeras: # # Name                    Version                   Build  Channel backcall                  0.1.0                    py36_0 bleach                    3.0.2                    py36_0 ca-certificates           2018.03.07                    0 certifi                   2018.11.29               py36_0 dbus                      1.13.2               h714fa37_1 decorator                 4.3.0                    py36_0 entrypoints               0.2.3                    py36_2 expat                     2.2.6                he6710b0_0 fontconfig                2.13.0               h9420a91_0 freetype                  2.9.1                h8a8886c_1 glib                      2.56.2               hd408876_0 gmp                       6.1.2                h6c8ec71_1 gst-plugins-base          1.14.0               hbbd80ab_1 gstreamer                 1.14.0               hb453b48_1 icu                       58.2                 h9c2bf20_1 ipykernel                 5.1.0            py36h39e3cac_0 ipython                   7.2.0            py36h39e3cac_0 ipython_genutils          0.2.0                    py36_0 ipywidgets                7.4.2                    py36_0 jedi                      0.13.1                   py36_0 jinja2                    2.10                     py36_0 jpeg                      9b                   h024ee3a_2 jsonschema                2.6.0                    py36_0 jupyter                   1.0.0                    py36_7 jupyter_client            5.2.3                    py36_0 jupyter_console           6.0.0                    py36_0 jupyter_core              4.4.0                    py36_0 Keras                     2.2.4                     <pip> libedit                   3.1.20170329         h6b74fdf_2 libffi                    3.2.1                hd88cf55_4 libgcc-ng                 8.2.0                hdf63c60_1 libpng                    1.6.35               hbc83047_0 libsodium                 1.0.16               h1bed415_0 libstdcxx-ng              8.2.0                hdf63c60_1 libuuid                   1.0.3                h1bed415_2 libxcb                    1.13                 h1bed415_1 libxml2                   2.9.8                h26e45fe_1 markupsafe                1.1.0            py36h7b6447c_0 mistune                   0.8.4            py36h7b6447c_0 nbconvert                 5.3.1                    py36_0 nbformat                  4.4.0                    py36_0 ncurses                   6.1                  he6710b0_1 notebook                  5.7.2                    py36_0 openssl                   1.1.1a               h7b6447c_0 pandoc                    2.2.3.2                       0 pandocfilters             1.4.2                    py36_1 parso                     0.3.1                    py36_0 pcre                      8.42                 h439df22_0 pexpect                   4.6.0                    py36_0 pickleshare               0.7.5                    py36_0 pip                       18.1                     py36_0 prometheus_client         0.4.2                    py36_0 prompt_toolkit            2.0.7                    py36_0 ptyprocess                0.6.0                    py36_0 pygments                  2.2.0                    py36_0 pyqt                      5.9.2            py36h05f1152_2 python                    3.6.7                h0371630_0 python-dateutil           2.7.5                    py36_0 PyYAML                    3.13                      <pip> pyzmq                     17.1.2           py36h14c3975_0 qt                        5.9.7                h5867ecd_1 qtconsole                 4.4.3                    py36_0 readline                  7.0                  h7b6447c_5 scipy                     1.1.0                     <pip> send2trash                1.5.0                    py36_0 setuptools                40.6.2                   py36_0 sip                       4.19.8           py36hf484d3e_0 six                       1.12.0                   py36_0 sqlite                    3.25.3               h7b6447c_0 terminado                 0.8.1                    py36_1 testpath                  0.4.2                    py36_0 tk                        8.6.8                hbc83047_0 tornado                   5.1.1            py36h7b6447c_0 traitlets                 4.3.2                    py36_0 wcwidth                   0.1.7                    py36_0 webencodings              0.5.1                    py36_1 wheel                     0.32.3                   py36_0 widgetsnbextension        3.4.2                    py36_0 xz                        5.2.4                h14c3975_4 zeromq                    4.2.5                hf484d3e_1 zlib                      1.2.11               h7b6447c_3  | cs | 
다시 위 코드를 실행해보자. 정상적으로 출력된다.
import tensorflow as tf
print ("TensorFlow version: " + tf.__version__)
원문출처 https://medium.com/@margaretmz/anaconda-jupyter-notebook-tensorflow-and-keras-b91f381405f8