본문 바로가기

현재

1. Deep Learning & AI 플랫폼 설치 (Ubuntu 18.04) Anaconda

Anaconda (with Python) 설치

파이선을 설치하는 방법에는 여러종류가 있으나 Anaconda(The World's Most Popular Python/R Data Science Platform)를 사용하면 필요한 패키지를 한꺼번에 설치할 수가 있어 아래에서 각 OS에 맞는 설치파일을 다운받아 설치한다

아나콘다는 기본적으로 파이썬뿐만 아니라 머신러닝을 위한 패키지(수학, 과학 분야의 패키지)인
넘파이, 판다스, 맷플롯립, 시본 그리고 주피터 노트북까지 함께 설치됨. 인공지능이나 데이터분석을 위해 python이 많이 사용되며 베이스로 아나콘다를 설치하고 시작하는 것이 업계표준 (아나콘다와 파이썬을 동시에 설치할 경우 환경변수에 문제가 발생 할 수 있으므로 주의 필요)

Window의 경우 상기와 같은 사유로 설치중 아래 PATH에 추가를 하면 python, pip등 관련 실행파일의 path가 걸려 좀더 편하게 사용할 수 있어 체크하고 설치한다. 설치시 path에 체크를 안했다면 path에 설치 경로 + 하기의 실행 디렉토리를 추가하도록 한다

Path에 추가된 항목

Hyper-V Ubuntu 18.04에 설치한 아나콘다 이력

1. 아나콘다 bash script 다운로드

kimyhee@kimyhee-Virtual-Machine:~/다운로드$ cd /tmp
kimyhee@kimyhee-Virtual-Machine:/tmp$ curl -O https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh

Command 'curl' not found, but can be installed with:

sudo apt install curl

** 컬이 없으니 먼저 인스톨하라고 알려준다

kimyhee@kimyhee-Virtual-Machine:/tmp$ sudo apt install curl
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
다음의 추가 패키지가 설치될 것입니다 :
  libcurl4
다음 새 패키지를 설치할 것입니다:
  curl libcurl4
0개 업그레이드, 2개 새로 설치, 0개 제거 및 0개 업그레이드 안 함.
373 k바이트 아카이브를 받아야 합니다.
이 작업 후 1,038 k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
받기:1 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.8 [214 kB]
받기:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.8 [159 kB]
내려받기 373 k바이트, 소요시간 3초 (144 k바이트/초)
Selecting previously unselected package libcurl4:amd64.
(데이터베이스 읽는중 ...현재 163815개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.8) ...
libcurl4:amd64 (7.58.0-2ubuntu3.8) 설정하는 중입니다 ...
curl (7.58.0-2ubuntu3.8) 설정하는 중입니다 ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
kimyhee@kimyhee-Virtual-Machine:/tmp$ curl -O https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  654M  100  654M    0     0  51.7M      0  0:00:12  0:00:12 --:--:-- 52.6M

2. 다운로드 인스톨러 검증
kimyhee@kimyhee-Virtual-Machine:/tmp$ sha256sum Anaconda3-2019.03-Linux-x86_64.sh
45c851b7497cc14d5ca060064394569f724b67d9b5f98a926ed49b834a6bb73a  Anaconda3-2019.03-Linux-x86_64.sh

 

3. 인스톨러 실행

kimyhee@kimyhee-Virtual-Machine:/tmp$ bash Anaconda3-2019.03-Linux-x86_64.sh

Welcome to Anaconda3 2019.03

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
===================================
Anaconda End User License Agreement
===================================

Copyright 2015, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

라이센스관련 내용 중략...


Do you accept the license terms? [yes|no]
[no] >>> yes

Anaconda3 will now be installed into this location:
/home/kimyhee/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/kimyhee/anaconda3] >>>
PREFIX=/home/kimyhee/anaconda3
installing: python-3.7.3-h0371630_0 ...
Python 3.7.3
installing: conda-env-2.6.0-1 ...
인스톨관련내용 중략...
installing: anaconda-2019.03-py37_0 ...
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
WARNING: The conda.compat module is deprecated and will be removed in a future release.
no change     /home/kimyhee/anaconda3/condabin/conda
no change     /home/kimyhee/anaconda3/bin/conda
no change     /home/kimyhee/anaconda3/bin/conda-env
no change     /home/kimyhee/anaconda3/bin/activate
no change     /home/kimyhee/anaconda3/bin/deactivate
no change     /home/kimyhee/anaconda3/etc/profile.d/conda.sh
no change     /home/kimyhee/anaconda3/etc/fish/conf.d/conda.fish
no change     /home/kimyhee/anaconda3/shell/condabin/Conda.psm1
no change     /home/kimyhee/anaconda3/shell/condabin/conda-hook.ps1
no change     /home/kimyhee/anaconda3/lib/python3.7/site-packages/xonsh/conda.xsh
no change     /home/kimyhee/anaconda3/etc/profile.d/conda.csh
modified      /home/kimyhee/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Anaconda3!

===========================================================================

Anaconda and JetBrains are working together to bring you Anaconda-powered
environments tightly integrated in the PyCharm IDE.

PyCharm for Anaconda is available at:
https://www.anaconda.com/pycharm

4. 인스톨본 활성화
kimyhee@kimyhee-Virtual-Machine:/tmp$ source ~/.bashrc

5. 인스톨본 테스트
(base) kimyhee@kimyhee-Virtual-Machine:/tmp$ conda list
WARNING: The conda.compat module is deprecated and will be removed in a future release.
# packages in environment at /home/kimyhee/anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py37_0  
alabaster                 0.7.12                   py37_0  
anaconda                  2019.03                  py37_0  
설치모듈관련 중략...
zstd                      1.3.7                h0b5b093_0

6. 아나콘다 환경 셋업
(base) kimyhee@kimyhee-Virtual-Machine:/tmp$ conda create --name my_env python=3

 

https://www.anaconda.com/c/pycharm/

 

www.anaconda.com

WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 4.6.11
  latest version: 4.8.0

Please update conda by running

    $ conda update -n base -c defaults conda

## Package Plan ##

  environment location: /home/kimyhee/anaconda3/envs/my_env

  added / updated specs:
    - python=3

The following packages will be downloaded:
    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB
    ca-certificates-2019.11.27 |                0         132 KB
    certifi-2019.11.28         |           py38_0         156 KB
    libgcc-ng-9.1.0            |       hdf63c60_0         8.1 MB
    libstdcxx-ng-9.1.0         |       hdf63c60_0         4.0 MB
    openssl-1.1.1d             |       h7b6447c_3         3.7 MB
    pip-19.3.1                 |           py38_0         1.9 MB
    python-3.8.0               |       h0371630_2        39.6 MB
    setuptools-42.0.2          |           py38_0         654 KB
    sqlite-3.30.1              |       h7b6447c_0         1.9 MB
    wheel-0.33.6               |           py38_0          35 KB
    ------------------------------------------------------------
                                           Total:        60.3 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  ca-certificates    pkgs/main/linux-64::ca-certificates-2019.11.27-0
  certifi            pkgs/main/linux-64::certifi-2019.11.28-py38_0
  libedit            pkgs/main/linux-64::libedit-3.1.20181209-hc058e9b_0
  libffi             pkgs/main/linux-64::libffi-3.2.1-hd88cf55_4
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
  ncurses            pkgs/main/linux-64::ncurses-6.1-he6710b0_1
  openssl            pkgs/main/linux-64::openssl-1.1.1d-h7b6447c_3
  pip                pkgs/main/linux-64::pip-19.3.1-py38_0
  python             pkgs/main/linux-64::python-3.8.0-h0371630_2
  readline           pkgs/main/linux-64::readline-7.0-h7b6447c_5
  setuptools         pkgs/main/linux-64::setuptools-42.0.2-py38_0
  sqlite             pkgs/main/linux-64::sqlite-3.30.1-h7b6447c_0
  tk                 pkgs/main/linux-64::tk-8.6.8-hbc83047_0
  wheel              pkgs/main/linux-64::wheel-0.33.6-py38_0
  xz                 pkgs/main/linux-64::xz-5.2.4-h14c3975_4
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3

Proceed ([y]/n)? y


Downloading and Extracting Packages
_libgcc_mutex-0.1    | 3 KB      | ##################################### | 100%
sqlite-3.30.1        | 1.9 MB    | ##################################### | 100%
pip-19.3.1           | 1.9 MB    | ##################################### | 100%
libstdcxx-ng-9.1.0   | 4.0 MB    | ##################################### | 100%
libgcc-ng-9.1.0      | 8.1 MB    | ##################################### | 100%
ca-certificates-2019 | 132 KB    | ##################################### | 100%
openssl-1.1.1d       | 3.7 MB    | ##################################### | 100%
python-3.8.0         | 39.6 MB   | ##################################### | 100%
wheel-0.33.6         | 35 KB     | ##################################### | 100%
setuptools-42.0.2    | 654 KB    | ##################################### | 100%
certifi-2019.11.28   | 156 KB    | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate my_env
#
# To deactivate an active environment, use
#
#     $ conda deactivate

7. 아나콘다 활성화
(base) kimyhee@kimyhee-Virtual-Machine:/tmp$ conda activate my_env

8. 터미널 종료후 아나콘다 네비게이터 실행
(base) kimyhee@kimyhee-Virtual-Machine:~$ anaconda-navigator
WARNING: The conda.compat module is deprecated and will be removed in a future release.
/home/kimyhee/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/conda_api.py:1364: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  data = yaml.load(f)
2020-01-13 16:39:39,488 - ERROR download_api._download:234
Invalid url https://www.anaconda.com/wp-content/uploads/2017/05/Webinar20-20Three20Ways20to20Move20your20Data20Science20Projects20to20Production.png

9. 주피터 실행 후 파이선 테스트

anaconda-navigator에서 jupyter Launch후 실행

위의 그림과 같이 실행이 되면 정상 설치됨^^