갈루아의 반서재

Photo by Markus Spiske from Pexels

아나콘다 가상환경의 파이썬 버전을 3.8 로 업그레이드 해보자. 물론 현재 시점에서는 new anaconda individual edition 2020 distribution 이 나와있는 상태이긴 하지만, 기존 버전 사용자의 경우 다음과 같이 업그레이드를 진행할 수 있다. 먼저 가상환경 활성화하기 이전 base 상태에서, conda 업데이트를 진행한다. 

 

conda 업데이트

(base) founder@hilbert:~$ conda update -n base -c defaults conda
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: /home/founder/anaconda3

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    asn1crypto-1.3.0           |           py38_0         163 KB
    cffi-1.14.0                |   py38h2e261b9_0         228 KB
    chardet-3.0.4              |        py38_1003         170 KB
    conda-4.8.3                |           py38_0         3.0 MB
    conda-package-handling-1.6.0|   py38h7b6447c_0         879 KB
    cryptography-2.8           |   py38h1ba5d50_0         618 KB
    pycosat-0.6.3              |   py38h7b6447c_0         113 KB
    pyopenssl-19.1.0           |           py38_0          87 KB
    pysocks-1.7.1              |           py38_0          27 KB
    requests-2.23.0            |           py38_0          91 KB
    ruamel_yaml-0.15.87        |   py38h7b6447c_0         269 KB
    six-1.14.0                 |           py38_0          27 KB
    tqdm-4.43.0                |             py_0          56 KB
    urllib3-1.25.8             |           py38_0         166 KB
    ------------------------------------------------------------
                                           Total:         5.9 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.6.0-py38h7b                                                                  6447c_0
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7

The following packages will be UPDATED:

  asn1crypto                                  0.24.0-py37_0 --> 1.3.0-py38_0
  ca-certificates     anaconda::ca-certificates-2019.1.23-0 --> pkgs/main::ca                                                                  -certificates-2020.1.1-0
  certifi               anaconda::certifi-2018.11.29-py37_0 --> pkgs/main::ce                                                                  rtifi-2019.11.28-py38_1
  cffi                                1.11.5-py37he75722e_1 --> 1.14.0-py38h2                                                                  e261b9_0
  chardet                                      3.0.4-py37_1 --> 3.0.4-py38_10                                                                  03
  conda                        anaconda::conda-4.6.4-py37_0 --> pkgs/main::co                                                                  nda-4.8.3-py38_0
  cryptography                         2.4.2-py37h1ba5d50_0 --> 2.8-py38h1ba5                                                                  d50_0
  idna                  pkgs/main/linux-64::idna-2.7-py37_0 --> pkgs/main/noa                                                                  rch::idna-2.9-py_1
  libedit                           3.1.20170329-h6b74fdf_2 --> 3.1.20181209-                                                                  hc058e9b_0
  libgcc-ng                                8.2.0-hdf63c60_1 --> 9.1.0-hdf63c6                                                                  0_0
  ncurses                                    6.1-hf484d3e_0 --> 6.2-he6710b0_                                                                  0
  pip                                         10.0.1-py37_0 --> 20.0.2-py38_1
  pycparser          pkgs/main/linux-64::pycparser-2.18-py~ --> pkgs/main/noa                                                                  rch::pycparser-2.20-py_0
  pyopenssl                                   18.0.0-py37_0 --> 19.1.0-py38_0
  pysocks                                      1.6.8-py37_0 --> 1.7.1-py38_0
  python                                   3.7.2-h0371630_0 --> 3.8.2-hcf3253                                                                  4_0
  readline                                   7.0-h7b6447c_5 --> 8.0-h7b6447c_                                                                  0
  requests                                    2.19.1-py37_0 --> 2.23.0-py38_0
  ruamel_yaml                        0.15.46-py37h14c3975_0 --> 0.15.87-py38h                                                                  7b6447c_0
  setuptools                                  40.2.0-py37_0 --> 46.1.1-py38_0
  six                                         1.11.0-py37_1 --> 1.14.0-py38_0
  sqlite                                  3.26.0-h7b6447c_0 --> 3.31.1-h7b644                                                                  7c_0
  tqdm               pkgs/main/linux-64::tqdm-4.26.0-py37h~ --> pkgs/main/noa                                                                  rch::tqdm-4.43.0-py_0
  urllib3                                       1.23-py37_0 --> 1.25.8-py38_0
  wheel                                       0.31.1-py37_0 --> 0.34.2-py38_0
  zlib                                    1.2.11-ha838bed_2 --> 1.2.11-h7b644                                                                  7c_3

The following packages will be SUPERSEDED by a higher-priority channel:

  openssl                anaconda::openssl-1.1.1-h7b6447c_0 --> pkgs/main::op                                                                  enssl-1.1.1e-h7b6447c_0

The following packages will be DOWNGRADED:

  pycosat                              0.6.3-py37h14c3975_0 --> 0.6.3-py38h7b                                                                  6447c_0


Proceed ([y]/n)?


Downloading and Extracting Packages
asn1crypto-1.3.0     | 163 KB    | #################################################################################################### | 100%
six-1.14.0           | 27 KB     | #################################################################################################### | 100%
tqdm-4.43.0          | 56 KB     | #################################################################################################### | 100%
cffi-1.14.0          | 228 KB    | #################################################################################################### | 100%
chardet-3.0.4        | 170 KB    | #################################################################################################### | 100%
pysocks-1.7.1        | 27 KB     | #################################################################################################### | 100%
cryptography-2.8     | 618 KB    | #################################################################################################### | 100%
requests-2.23.0      | 91 KB     | #################################################################################################### | 100%
pycosat-0.6.3        | 113 KB    | #################################################################################################### | 100%
conda-4.8.3          | 3.0 MB    | #################################################################################################### | 100%
conda-package-handli | 879 KB    | #################################################################################################### | 100%
pyopenssl-19.1.0     | 87 KB     | #################################################################################################### | 100%
ruamel_yaml-0.15.87  | 269 KB    | #################################################################################################### | 100%
urllib3-1.25.8       | 166 KB    | #################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) founder@hilbert:~$

conda 버전 체크

$를 이용하여 설치된 패키지중 이름이 “anaconda” 인 것만 볼 수 있다.

(base) founder@hilbert:~$ conda list anaconda$
# packages in environment at /home/founder/anaconda3:
#
# Name                    Version                   Build  Channel
anaconda                  5.3.0                    py37_0
(base) founder@hilbert:~$

파이썬 3.8 기반 새로운 가상환경 생성

(base) founder@hilbert:~$ conda create --name quantum python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/founder/anaconda3/envs/quantum

  added / updated specs:
    - python=3.8


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB
    ca-certificates-2020.1.1   |                0         125 KB
    ld_impl_linux-64-2.33.1    |       h53a641e_7         568 KB
    libedit-3.1.20181209       |       hc058e9b_0         163 KB
    libffi-3.2.1               |       hd88cf55_4          40 KB
    libgcc-ng-9.1.0            |       hdf63c60_0         5.1 MB
    libstdcxx-ng-9.1.0         |       hdf63c60_0         3.1 MB
    openssl-1.1.1e             |       h7b6447c_0         2.5 MB
    pip-20.0.2                 |           py38_1         1.7 MB
    python-3.8.2               |       hcf32534_0        49.6 MB
    readline-8.0               |       h7b6447c_0         356 KB
    setuptools-46.1.1          |           py38_0         513 KB
    sqlite-3.31.1              |       h7b6447c_0         1.1 MB
    tk-8.6.8                   |       hbc83047_0         2.8 MB
    wheel-0.34.2               |           py38_0          51 KB
    xz-5.2.4                   |       h14c3975_4         283 KB
    zlib-1.2.11                |       h7b6447c_3         103 KB
    ------------------------------------------------------------
                                           Total:        68.0 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-2020.1.1-0
  certifi            pkgs/main/linux-64::certifi-2019.11.28-py38_1
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
  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.2-he6710b0_0
  openssl            pkgs/main/linux-64::openssl-1.1.1e-h7b6447c_0
  pip                pkgs/main/linux-64::pip-20.0.2-py38_1
  python             pkgs/main/linux-64::python-3.8.2-hcf32534_0
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  setuptools         pkgs/main/linux-64::setuptools-46.1.1-py38_0
  sqlite             pkgs/main/linux-64::sqlite-3.31.1-h7b6447c_0
  tk                 pkgs/main/linux-64::tk-8.6.8-hbc83047_0
  wheel              pkgs/main/linux-64::wheel-0.34.2-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
readline-8.0         | 356 KB    | #################################################################################################### | 100%
pip-20.0.2           | 1.7 MB    | #################################################################################################### | 100%
libedit-3.1.20181209 | 163 KB    | #################################################################################################### | 100%
libffi-3.2.1         | 40 KB     | #################################################################################################### | 100%
wheel-0.34.2         | 51 KB     | #################################################################################################### | 100%
zlib-1.2.11          | 103 KB    | #################################################################################################### | 100%
libstdcxx-ng-9.1.0   | 3.1 MB    | #################################################################################################### | 100%
ld_impl_linux-64-2.3 | 568 KB    | #################################################################################################### | 100%
python-3.8.2         | 49.6 MB   | #################################################################################################### | 100%
sqlite-3.31.1        | 1.1 MB    | #################################################################################################### | 100%
ca-certificates-2020 | 125 KB    | #################################################################################################### | 100%
_libgcc_mutex-0.1    | 3 KB      | #################################################################################################### | 100%
xz-5.2.4             | 283 KB    | #################################################################################################### | 100%
openssl-1.1.1e       | 2.5 MB    | #################################################################################################### | 100%
libgcc-ng-9.1.0      | 5.1 MB    | #################################################################################################### | 100%
tk-8.6.8             | 2.8 MB    | #################################################################################################### | 100%
setuptools-46.1.1    | 513 KB    | #################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate quantum
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) founder@hilbert:~$

가상환경 활성화/비활성화는 다음과 같이 할 수 있다

(base) founder@hilbert:~$ conda activate quantum
(quantum) founder@hilbert:~$
(quantum) founder@hilbert:~$ conda deactivate
(base) founder@hilbert:~$