reticulate (R interface to Python)

Published by onesixx on

요약페이지 : https://onesixx.com/reticulate-ex/

Image
https://rstudio.github.io/reticulate/
https://dowtech.tistory.com/14 – conda명령어
install_miniconda()
https://github.com/rstudio/reticulate
https://blog.rstudio.com/tags/reticulate

R에서 Python을 사용할수 있는 Tools을제공
– R에서 R Markdown으로 Python을 call할수 있다
– Conda 환경( virtual 환경)을

#install.packages('reticulate')
library(reticulate)

###### 10. Install miniconda ---------------------------------------------------
install_miniconda()
# miniconda_path()
# Sys.getenv('RETICULATE_MINICONDA_PATH')
Sys.setenv(RETICULATE_MINICONDA_PATH="/home/oschung_skcc/.local/share/r-miniconda")


###### 10. Add my conda(virtual)env --------------------------------------------

conda_list()
#conda_binary()
#conda_list(conda=conda_binary())

#conda_remove(envname="sixxDL")
#conda_remove(envname="sixxDL", conda="/home/oschung_skcc/.local/share/r-miniconda/bin/conda")

conda_create(envname="sixxDL")
# $ conda create --name sixxDL python=3.6
# $ conda activate sixxDL
# $ conda install -c conda-forge scipy=1.4.1
use_condaenv(condaenv='sixxDL', required=T) #cf.> use_python, use_virtualenv, use_miniconda
use_python(python="~/.local/share/r-miniconda/envs/sixxDL/bin/python" )

#-----------------------------------------------------------------------------
library('keras')
install_keras(method="conda", tensorflow = "gpu")

#.rs.restartR()  # cmd+shift+F10
use_condaenv(condaenv='sixxDL', required=T) #cf.> use_python, use_virtualenv, use_miniconda
use_python(python="~/.local/share/r-miniconda/envs/sixxDL/bin/python" )

py_config()

###### For mac #######
#conda_install('sixxDL', 'plaidml-keras')
#use_backend(backend="plaidml") #  (cf. "tensorflow", "cntk", "theano")

minicoda 설치

  • Python 사용환경 ( Anaconda의 가벼운 버전)
  • 패키지 관리자
  • Virtual환경 제공
> install_miniconda()
* Downloading 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh' ...
trying URL 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh'
Content type 'application/x-sh' length 93052469 bytes (88.7 MB)
==================================================
downloaded 88.7 MB

* Installing Miniconda -- please wait a moment ...
PREFIX=/home/oschung_skcc/.local/share/r-miniconda
Unpacking payload ...
Collecting package metadata (current_repodata.json): ...working... done                                        
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/oschung_skcc/.local/share/r-miniconda

  added / updated specs:
    - _libgcc_mutex==0.1=main
    - ca-certificates==2020.1.1=0
    - certifi==2020.4.5.1=py38_0
    - cffi==1.14.0=py38he30daa8_1
    - chardet==3.0.4=py38_1003
    - conda-package-handling==1.6.1=py38h7b6447c_0
    - conda==4.8.3=py38_0
    - cryptography==2.9.2=py38h1ba5d50_0
    - idna==2.9=py_1
    - ld_impl_linux-64==2.33.1=h53a641e_7
    - libedit==3.1.20181209=hc058e9b_0
    - libffi==3.3=he6710b0_1
    - libgcc-ng==9.1.0=hdf63c60_0
    - libstdcxx-ng==9.1.0=hdf63c60_0
    - ncurses==6.2=he6710b0_1
    - openssl==1.1.1g=h7b6447c_0
    - pip==20.0.2=py38_3
    - pycosat==0.6.3=py38h7b6447c_1
    - pycparser==2.20=py_0
    - pyopenssl==19.1.0=py38_0
    - pysocks==1.7.1=py38_0
    - python==3.8.3=hcff3b4d_0
    - readline==8.0=h7b6447c_0
    - requests==2.23.0=py38_0
    - ruamel_yaml==0.15.87=py38h7b6447c_0
    - setuptools==46.4.0=py38_0
    - six==1.14.0=py38_0
    - sqlite==3.31.1=h62c20be_1
    - tk==8.6.8=hbc83047_0
    - tqdm==4.46.0=py_0
    - urllib3==1.25.8=py38_0
    - wheel==0.34.2=py38_0
    - xz==5.2.5=h7b6447c_0
    - yaml==0.1.7=had09818_2
    - zlib==1.2.11=h7b6447c_3


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-2020.4.5.1-py38_0
  cffi               pkgs/main/linux-64::cffi-1.14.0-py38he30daa8_1
  chardet            pkgs/main/linux-64::chardet-3.0.4-py38_1003
  conda              pkgs/main/linux-64::conda-4.8.3-py38_0
  conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.6.1-py38h7b6447c_0
  cryptography       pkgs/main/linux-64::cryptography-2.9.2-py38h1ba5d50_0
  idna               pkgs/main/noarch::idna-2.9-py_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.3-he6710b0_1
  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_1
  openssl            pkgs/main/linux-64::openssl-1.1.1g-h7b6447c_0
  pip                pkgs/main/linux-64::pip-20.0.2-py38_3
  pycosat            pkgs/main/linux-64::pycosat-0.6.3-py38h7b6447c_1
  pycparser          pkgs/main/noarch::pycparser-2.20-py_0
  pyopenssl          pkgs/main/linux-64::pyopenssl-19.1.0-py38_0
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py38_0
  python             pkgs/main/linux-64::python-3.8.3-hcff3b4d_0
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  requests           pkgs/main/linux-64::requests-2.23.0-py38_0
  ruamel_yaml        pkgs/main/linux-64::ruamel_yaml-0.15.87-py38h7b6447c_0
  setuptools         pkgs/main/linux-64::setuptools-46.4.0-py38_0
  six                pkgs/main/linux-64::six-1.14.0-py38_0
  sqlite             pkgs/main/linux-64::sqlite-3.31.1-h62c20be_1
  tk                 pkgs/main/linux-64::tk-8.6.8-hbc83047_0
  tqdm               pkgs/main/noarch::tqdm-4.46.0-py_0
  urllib3            pkgs/main/linux-64::urllib3-1.25.8-py38_0
  wheel              pkgs/main/linux-64::wheel-0.34.2-py38_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  yaml               pkgs/main/linux-64::yaml-0.1.7-had09818_2
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Preparing transaction: ...working... done
Executing transaction: ...working... done
installation finished.
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/oschung_skcc/.local/share/r-miniconda

  added / updated specs:
    - conda


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    brotlipy-0.7.0             |py38h7b6447c_1000         322 KB
    ca-certificates-2020.6.24  |                0         125 KB
    certifi-2020.6.20          |           py38_0         156 KB
    idna-2.10                  |             py_0          50 KB
    libedit-3.1.20191231       |       h14c3975_1         116 KB
    libffi-3.3                 |       he6710b0_2          50 KB
    pip-20.1.1                 |           py38_1         1.7 MB
    pycparser-2.20             |             py_2          94 KB
    pyopenssl-19.1.0           |             py_1          48 KB
    requests-2.24.0            |             py_0          56 KB
    ruamel_yaml-0.15.87        |   py38h7b6447c_1         249 KB
    setuptools-49.2.0          |           py38_0         737 KB
    six-1.15.0                 |             py_0          13 KB
    sqlite-3.32.3              |       h62c20be_0         1.1 MB
    tk-8.6.10                  |       hbc83047_0         3.0 MB
    tqdm-4.47.0                |             py_0          62 KB
    urllib3-1.25.9             |             py_0         103 KB
    yaml-0.2.5                 |       h7b6447c_0          75 KB
    ------------------------------------------------------------
                                           Total:         8.0 MB

The following NEW packages will be INSTALLED:

  brotlipy           pkgs/main/linux-64::brotlipy-0.7.0-py38h7b6447c_1000

The following packages will be UPDATED:

  ca-certificates                                2020.1.1-0 --> 2020.6.24-0
  certifi                                 2020.4.5.1-py38_0 --> 2020.6.20-py38_0
  idna                                             2.9-py_1 --> 2.10-py_0
  libedit                           3.1.20181209-hc058e9b_0 --> 3.1.20191231-h14c3975_1
  libffi                                     3.3-he6710b0_1 --> 3.3-he6710b0_2
  pip                                         20.0.2-py38_3 --> 20.1.1-py38_1
  pycparser                                       2.20-py_0 --> 2.20-py_2
  pyopenssl          pkgs/main/linux-64::pyopenssl-19.1.0-~ --> pkgs/main/noarch::pyopenssl-19.1.0-py_1
  requests           pkgs/main/linux-64::requests-2.23.0-p~ --> pkgs/main/noarch::requests-2.24.0-py_0
  ruamel_yaml                        0.15.87-py38h7b6447c_0 --> 0.15.87-py38h7b6447c_1
  setuptools                                  46.4.0-py38_0 --> 49.2.0-py38_0
  six                 pkgs/main/linux-64::six-1.14.0-py38_0 --> pkgs/main/noarch::six-1.15.0-py_0
  sqlite                                  3.31.1-h62c20be_1 --> 3.32.3-h62c20be_0
  tk                                       8.6.8-hbc83047_0 --> 8.6.10-hbc83047_0
  tqdm                                          4.46.0-py_0 --> 4.47.0-py_0
  urllib3            pkgs/main/linux-64::urllib3-1.25.8-py~ --> pkgs/main/noarch::urllib3-1.25.9-py_0
  yaml                                     0.1.7-had09818_2 --> 0.2.5-h7b6447c_0



Downloading and Extracting Packages
idna-2.10            | 50 KB     | ########## | 100% 
libffi-3.3           | 50 KB     | ########## | 100% 
tk-8.6.10            | 3.0 MB    | ########## | 100% 
brotlipy-0.7.0       | 322 KB    | ########## | 100% 
setuptools-49.2.0    | 737 KB    | ########## | 100% 
ca-certificates-2020 | 125 KB    | ########## | 100% 
libedit-3.1.20191231 | 116 KB    | ########## | 100% 
pip-20.1.1           | 1.7 MB    | ########## | 100% 
urllib3-1.25.9       | 103 KB    | ########## | 100% 
ruamel_yaml-0.15.87  | 249 KB    | ########## | 100% 
sqlite-3.32.3        | 1.1 MB    | ########## | 100% 
pycparser-2.20       | 94 KB     | ########## | 100% 
certifi-2020.6.20    | 156 KB    | ########## | 100% 
six-1.15.0           | 13 KB     | ########## | 100% 
yaml-0.2.5           | 75 KB     | ########## | 100% 
pyopenssl-19.1.0     | 48 KB     | ########## | 100% 
tqdm-4.47.0          | 62 KB     | ########## | 100% 
requests-2.24.0      | 56 KB     | ########## | 100% 
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/oschung_skcc/.local/share/r-miniconda/envs/r-reticulate

  added / updated specs:
    - numpy
    - python=3.6


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    blas-1.0                   |              mkl           6 KB
    certifi-2020.6.20          |           py36_0         156 KB
    intel-openmp-2020.1        |              217         780 KB
    mkl-2020.1                 |              217       129.0 MB
    mkl-service-2.3.0          |   py36he904b0f_0         219 KB
    mkl_fft-1.1.0              |   py36h23d657b_0         144 KB
    mkl_random-1.1.1           |   py36h0573a6f_0         327 KB
    numpy-1.19.1               |   py36hbc911f0_0          21 KB
    numpy-base-1.19.1          |   py36hfa32c7d_0         4.1 MB
    pip-20.1.1                 |           py36_1         1.8 MB
    python-3.6.10              |       h7579374_2        29.7 MB
    setuptools-49.2.0          |           py36_0         748 KB
    wheel-0.34.2               |           py36_0          51 KB
    ------------------------------------------------------------
                                           Total:       167.0 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  blas               pkgs/main/linux-64::blas-1.0-mkl
  ca-certificates    pkgs/main/linux-64::ca-certificates-2020.6.24-0
  certifi            pkgs/main/linux-64::certifi-2020.6.20-py36_0
  intel-openmp       pkgs/main/linux-64::intel-openmp-2020.1-217
  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.20191231-h14c3975_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  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
  mkl                pkgs/main/linux-64::mkl-2020.1-217
  mkl-service        pkgs/main/linux-64::mkl-service-2.3.0-py36he904b0f_0
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.1.0-py36h23d657b_0
  mkl_random         pkgs/main/linux-64::mkl_random-1.1.1-py36h0573a6f_0
  ncurses            pkgs/main/linux-64::ncurses-6.2-he6710b0_1
  numpy              pkgs/main/linux-64::numpy-1.19.1-py36hbc911f0_0
  numpy-base         pkgs/main/linux-64::numpy-base-1.19.1-py36hfa32c7d_0
  openssl            pkgs/main/linux-64::openssl-1.1.1g-h7b6447c_0
  pip                pkgs/main/linux-64::pip-20.1.1-py36_1
  python             pkgs/main/linux-64::python-3.6.10-h7579374_2
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  setuptools         pkgs/main/linux-64::setuptools-49.2.0-py36_0
  six                pkgs/main/noarch::six-1.15.0-py_0
  sqlite             pkgs/main/linux-64::sqlite-3.32.3-h62c20be_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  wheel              pkgs/main/linux-64::wheel-0.34.2-py36_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3



Downloading and Extracting Packages
certifi-2020.6.20    | 156 KB    | ########## | 100% 
pip-20.1.1           | 1.8 MB    | ########## | 100% 
mkl-2020.1           | 129.0 MB  | ########## | 100% 
setuptools-49.2.0    | 748 KB    | ########## | 100% 
intel-openmp-2020.1  | 780 KB    | ########## | 100% 
numpy-base-1.19.1    | 4.1 MB    | ########## | 100% 
mkl_random-1.1.1     | 327 KB    | ########## | 100% 
numpy-1.19.1         | 21 KB     | ########## | 100% 
mkl_fft-1.1.0        | 144 KB    | ########## | 100% 
python-3.6.10        | 29.7 MB   | ########## | 100% 
wheel-0.34.2         | 51 KB     | ########## | 100% 
blas-1.0             | 6 KB      | ########## | 100% 
mkl-service-2.3.0    | 219 KB    | ########## | 100% 
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
#     $ conda activate r-reticulate
#
# To deactivate an active environment, use
#
#     $ conda deactivate

* Miniconda has been successfully installed at '/home/oschung_skcc/.local/share/r-miniconda'.
[1] "/home/oschung_skcc/.local/share/r-miniconda"

설치된 경로 확인

> miniconda_path()
[1] "/home/oschung_skcc/.local/share/r-miniconda"
> Sys.setenv(RETICULATE_MINICONDA_PATH="/home/oschung_skcc/.local/share/r-miniconda")
> Sys.getenv('RETICULATE_MINICONDA_PATH')

miniconda와 가상환경 r-reticulate 이 만들어짐

> conda_list()
          name                                                                   python
1  r-miniconda   /home/oschung_skcc/.local/share/r-miniconda/bin/python
2 r-reticulate   /home/oschung_skcc/.local/share/r-miniconda/envs/r-reticulate/bin/python
~$➜  conda update conda             # 버전 업데이트
~$➜  conda info                     # 정보/버전/active 등 정보 확인 
~$➜  conda --help                   # help
$➜ ll .local
total 4
drwxr-xr-x.  3 oschung_skcc oschung_skcc   27 Aug  6 06:17 ./
drwxr-xr-x. 10 oschung_skcc rusers       4096 Aug  6 06:55 ../
drwxr-xr-x.  3 oschung_skcc oschung_skcc   33 Aug  6 06:17 share/

$➜ ll .conda
total 8
drwxr-xr-x.  2 oschung_skcc oschung_skcc   38 Aug  6 06:55 ./
drwxr-xr-x. 10 oschung_skcc rusers       4096 Aug  6 06:55 ../
-rw-r--r--.  1 oschung_skcc oschung_skcc  162 Aug  6 06:42 environments.txt

$➜ ll /home/oschung_skcc/.local/share/r-miniconda/envs
total 4
drwxr-xr-x.  4 oschung_skcc oschung_skcc   84 Aug  6 06:42 ./
drwxr-xr-x. 16 oschung_skcc oschung_skcc 4096 Aug  6 06:18 ../
-rw-r--r--.  1 oschung_skcc oschung_skcc    0 Aug  6 06:18 .conda_envs_dir_test
drwxr-xr-x. 11 oschung_skcc oschung_skcc  213 Aug  6 06:18 r-reticulate/
drwxr-xr-x. 11 oschung_skcc oschung_skcc  213 Aug  6 06:42 sixxDL/

miniconda 설정

conda init 은 ~/.bashrc 에 아래 내용을 추가

$➜  ~/.local/share/r-miniconda/bin/conda init bash
#$➜  ~/.local/share/r-miniconda/bin/conda init zsh
$➜ cd /home/oschung_skcc/.local/share/r-miniconda/bin
$➜ ./conda init zsh
no change     /home/oschung_skcc/.local/share/r-miniconda/condabin/conda
no change     /home/oschung_skcc/.local/share/r-miniconda/bin/conda
no change     /home/oschung_skcc/.local/share/r-miniconda/bin/conda-env
no change     /home/oschung_skcc/.local/share/r-miniconda/bin/activate
no change     /home/oschung_skcc/.local/share/r-miniconda/bin/deactivate
no change     /home/oschung_skcc/.local/share/r-miniconda/etc/profile.d/conda.sh
no change     /home/oschung_skcc/.local/share/r-miniconda/etc/fish/conf.d/conda.fish
no change     /home/oschung_skcc/.local/share/r-miniconda/shell/condabin/Conda.psm1
no change     /home/oschung_skcc/.local/share/r-miniconda/shell/condabin/conda-hook.ps1
no change     /home/oschung_skcc/.local/share/r-miniconda/lib/python3.8/site-packages/xontrib/conda.xsh
no change     /home/oschung_skcc/.local/share/r-miniconda/etc/profile.d/conda.csh
modified      /root/.bashrc

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

$➜ exit
$➜ source ~/.bashrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/oschung_skcc/.local/share/r-miniconda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/oschung_skcc/.local/share/r-miniconda/etc/profile.d/conda.sh" ]; then
        . "/home/oschung_skcc/.local/share/r-miniconda/etc/profile.d/conda.sh"
    else
        export PATH="/home/oschung_skcc/.local/share/r-miniconda/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

Terminal을 restart하고, 가상환경을 활성화해서 잘 적용됐는지 확인

가상환경 설치 (virtualenv대신 conda사용)

현재 가상환경 확인

> conda_list()
          name                                                                   python
1  r-miniconda                   /home/oschung_skcc/.local/share/r-miniconda/bin/python
2 r-reticulate /home/oschung_skcc/.local/share/r-miniconda/envs/r-reticulate/bin/python

> conda_list()[[1]][2]
[1] "r-reticulate"
~$➜ conda info --env
~$➜ conda env list

새로운 가상환경 생성/추가

> conda_create('sixxDL')
> # conda_create(envname='sixxDL')
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL

  added / updated specs:
    - python


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.6.24-0
  certifi            pkgs/main/linux-64::certifi-2020.6.20-py38_0
  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.20191231-h14c3975_1
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  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_1
  openssl            pkgs/main/linux-64::openssl-1.1.1g-h7b6447c_0
  pip                pkgs/main/linux-64::pip-20.1.1-py38_1
  python             pkgs/main/linux-64::python-3.8.3-hcff3b4d_2
  readline           pkgs/main/linux-64::readline-8.0-h7b6447c_0
  setuptools         pkgs/main/linux-64::setuptools-49.2.0-py38_0
  sqlite             pkgs/main/linux-64::sqlite-3.32.3-h62c20be_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  wheel              pkgs/main/linux-64::wheel-0.34.2-py38_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use
#
#     $ conda activate sixxDL
#
# To deactivate an active environment, use
#
#     $ conda deactivate

[1] "/home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL/bin/python"

가상환경 활성화

use_condaenv("sixxDL", required=T)

conda_list()[[1]][3] %>% use_condaenv(required=T)
~$➜  conda activate sixxDL

~$➜  conda info --env
# conda environments:
#
base                     /Users/onesixx/Library/r-miniconda
sixxDL                *  /Users/onesixx/Library/r-miniconda/envs/sixxDL
r-reticulate             /Users/onesixx/Library/r-miniconda/envs/r-reticulate

~$➜ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
ncurses                   6.2                  he1b5a44_1    conda-forge
openssl                   1.1.1g               h516909a_1    conda-forge
pip                       20.2.1                     py_0    conda-forge
python                    3.8.5           h4d41432_2_cpython    conda-forge
python_abi                3.8                      1_cp38    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
setuptools                49.2.1           py38h32f6830_0    conda-forge
sqlite                    3.32.3               hcee41ef_1    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge

가상환경 비활성화

...
~$➜  conda deactivate

가상환경 삭제

> conda_remove('sixxDL')
~$➜ conda deactivate
~$➜ conda remove --name sixxDL --all 
## Package Plan ##

  environment location: /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL


The following packages will be REMOVED:

  _libgcc_mutex-0.1-main
  ca-certificates-2020.6.24-0
  certifi-2020.6.20-py38_0
  ld_impl_linux-64-2.33.1-h53a641e_7
  libedit-3.1.20191231-h14c3975_1
  libffi-3.3-he6710b0_2
  libgcc-ng-9.1.0-hdf63c60_0
  libstdcxx-ng-9.1.0-hdf63c60_0
  ncurses-6.2-he6710b0_1
  openssl-1.1.1g-h7b6447c_0
  pip-20.1.1-py38_1
  python-3.8.3-hcff3b4d_2
  readline-8.0-h7b6447c_0
  setuptools-49.2.0-py38_0
  sqlite-3.32.3-h62c20be_0
  tk-8.6.10-hbc83047_0
  wheel-0.34.2-py38_0
  xz-5.2.5-h7b6447c_0
  zlib-1.2.11-h7b6447c_3


Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done

Remove all packages in environment /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL:

패키지 설치/ 리스트확인

> conda_install("sixxDL", "scipy")    # install SciPy

# import SciPy (it will be automatically discovered in "sixxDL")
scipy <- import("scipy")
~$➜ conda install <팩키지명>
~$➜ pip install <팩키지명>
~$➜ conda list

다른점

  • shape을 만들 때 list 사용
  • None은 NULL로 표현
  • tf. 이 tf$으로 해야 한다는 것
(sixxDL) ~$➜ conda deactivate

(base) ~$➜ conda info --env
# conda environments:
#
base                  *  /home/oschung_skcc/.local/share/r-miniconda
r-reticulate             /home/oschung_skcc/.local/share/r-miniconda/envs/r-reticulate
sixxDL                   /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL

(base) oschung_skcc@cf1d8cf6e830:~/RCODE/kerasbook$ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
brotlipy                  0.7.0           py38h7b6447c_1000
ca-certificates           2020.6.24                     0
certifi                   2020.6.20                py38_0
cffi                      1.14.0           py38he30daa8_1
chardet                   3.0.4                 py38_1003
conda                     4.8.3                    py38_0
conda-package-handling    1.6.1            py38h7b6447c_0
cryptography              2.9.2            py38h1ba5d50_0
idna                      2.10                       py_0
ld_impl_linux-64          2.33.1               h53a641e_7
libedit                   3.1.20191231         h14c3975_1
libffi                    3.3                  he6710b0_2
libgcc-ng                 9.1.0                hdf63c60_0
libstdcxx-ng              9.1.0                hdf63c60_0
ncurses                   6.2                  he6710b0_1
openssl                   1.1.1g               h7b6447c_0
pip                       20.1.1                   py38_1
pycosat                   0.6.3            py38h7b6447c_1
pycparser                 2.20                       py_2
pyopenssl                 19.1.0                     py_1
pysocks                   1.7.1                    py38_0
python                    3.8.3                hcff3b4d_0
readline                  8.0                  h7b6447c_0
requests                  2.24.0                     py_0
ruamel_yaml               0.15.87          py38h7b6447c_1
setuptools                49.2.0                   py38_0
six                       1.15.0                     py_0
sqlite                    3.32.3               h62c20be_0
tk                        8.6.10               hbc83047_0
tqdm                      4.47.0                     py_0
urllib3                   1.25.9                     py_0
wheel                     0.34.2                   py38_0
xz                        5.2.5                h7b6447c_0
yaml                      0.2.5                h7b6447c_0
zlib                      1.2.11               h7b6447c_3


(base) ~$➜ conda activate r-reticulate
(r-reticulate) ~$➜ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda/envs/r-reticulate:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py36h9f0ad1d_0    conda-forge
ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgfortran-ng            7.5.0               hdf63c60_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
libopenblas               0.3.10          pthreads_hb3c22a3_4    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
ncurses                   6.2                  he1b5a44_1    conda-forge
numpy                     1.19.1           py36h7314795_0    conda-forge
openssl                   1.1.1g               h516909a_1    conda-forge
pip                       20.2.1                     py_0    conda-forge
python                    3.6.11          h4d41432_2_cpython    conda-forge
python_abi                3.6                     1_cp36m    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
setuptools                49.2.1           py36h9f0ad1d_0    conda-forge
sqlite                    3.32.3               hcee41ef_1    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge


(r-reticulate) ~$➜ conda activate sixxDL
(sixxDL) ~$➜ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
ncurses                   6.2                  he1b5a44_1    conda-forge
openssl                   1.1.1g               h516909a_1    conda-forge
pip                       20.2.1                     py_0    conda-forge
python                    3.8.5           h4d41432_2_cpython    conda-forge
python_abi                3.8                      1_cp38    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
setuptools                49.2.1           py38h32f6830_0    conda-forge
sqlite                    3.32.3               hcee41ef_1    conda-forge
tk                        8.6.10               hed695b0_0    conda-forge
wheel                     0.34.2                     py_1    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h516909a_1006    conda-forge


####### After installing keras 
(sixxDL) oschung_skcc@cf1d8cf6e830:~/RCODE/kerasbook$ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
absl-py                   0.9.0                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
ca-certificates           2020.6.24                     0
cachetools                4.1.1                    pypi_0    pypi
certifi                   2020.6.20                py36_0
chardet                   3.0.4                    pypi_0    pypi
gast                      0.3.3                    pypi_0    pypi
google-auth               1.20.0                   pypi_0    pypi
google-auth-oauthlib      0.4.1                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
grpcio                    1.31.0                   pypi_0    pypi
h5py                      2.10.0                   pypi_0    pypi
idna                      2.10                     pypi_0    pypi
importlib-metadata        1.7.0                    pypi_0    pypi
keras                     2.4.3                    pypi_0    pypi
keras-preprocessing       1.1.2                    pypi_0    pypi
ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
markdown                  3.2.2                    pypi_0    pypi
ncurses                   6.2                  he1b5a44_1    conda-forge
numpy                     1.19.1                   pypi_0    pypi
oauthlib                  3.1.0                    pypi_0    pypi
openssl                   1.1.1g               h7b6447c_0
opt-einsum                3.3.0                    pypi_0    pypi
pillow                    7.2.0                    pypi_0    pypi
pip                       20.2.1                     py_0    conda-forge
protobuf                  3.12.4                   pypi_0    pypi
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
python                    3.6.10               hcf32534_1
pyyaml                    3.12                     pypi_0    pypi
readline                  8.0                  he28a2e2_2    conda-forge
requests                  2.24.0                   pypi_0    pypi
requests-oauthlib         1.3.0                    pypi_0    pypi
rsa                       4.6                      pypi_0    pypi
scipy                     1.5.2                    pypi_0    pypi
setuptools                49.2.0                   py36_0
six                       1.15.0                   pypi_0    pypi
sqlite                    3.32.3               hcee41ef_1    conda-forge
tensorboard               2.2.2                    pypi_0    pypi
tensorboard-plugin-wit    1.7.0                    pypi_0    pypi
tensorflow-estimator      2.2.0                    pypi_0    pypi
tensorflow-gpu            2.2.0                    pypi_0    pypi
tensorflow-hub            0.8.0                    pypi_0    pypi
termcolor                 1.1.0                    pypi_0    pypi
tk                        8.6.10               hed695b0_0    conda-forge
urllib3                   1.25.10                  pypi_0    pypi
werkzeug                  1.0.1                    pypi_0    pypi
wheel                     0.34.2                     py_1    conda-forge
wrapt                     1.12.1                   pypi_0    pypi
xz                        5.2.5                h516909a_1    conda-forge
zipp                      3.1.0                    pypi_0    pypi
zlib                      1.2.11            h516909a_1006    conda-forge


# After py_config()
(sixxDL) oschung_skcc@cf1d8cf6e830:~/RCODE/kerasbook$ conda list
# packages in environment at /home/oschung_skcc/.local/share/r-miniconda/envs/sixxDL:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
absl-py                   0.9.0                    pypi_0    pypi
astunparse                1.6.3                    pypi_0    pypi
ca-certificates           2020.6.24                     0
cachetools                4.1.1                    pypi_0    pypi
certifi                   2020.6.20                py36_0
chardet                   3.0.4                    pypi_0    pypi
gast                      0.3.3                    pypi_0    pypi
google-auth               1.20.0                   pypi_0    pypi
google-auth-oauthlib      0.4.1                    pypi_0    pypi
google-pasta              0.2.0                    pypi_0    pypi
grpcio                    1.31.0                   pypi_0    pypi
h5py                      2.10.0                   pypi_0    pypi
idna                      2.10                     pypi_0    pypi
importlib-metadata        1.7.0                    pypi_0    pypi
keras                     2.4.3                    pypi_0    pypi
keras-preprocessing       1.1.2                    pypi_0    pypi
ld_impl_linux-64          2.34                 hc38a660_9    conda-forge
libffi                    3.2.1             he1b5a44_1007    conda-forge
libgcc-ng                 9.3.0               h24d8f2e_14    conda-forge
libgomp                   9.3.0               h24d8f2e_14    conda-forge
libstdcxx-ng              9.3.0               hdf63c60_14    conda-forge
markdown                  3.2.2                    pypi_0    pypi
ncurses                   6.2                  he1b5a44_1    conda-forge
numpy                     1.18.5                   pypi_0    pypi
oauthlib                  3.1.0                    pypi_0    pypi
openssl                   1.1.1g               h7b6447c_0
opt-einsum                3.3.0                    pypi_0    pypi
pillow                    7.2.0                    pypi_0    pypi
pip                       20.2.1                     py_0    conda-forge
protobuf                  3.12.4                   pypi_0    pypi
pyasn1                    0.4.8                    pypi_0    pypi
pyasn1-modules            0.2.8                    pypi_0    pypi
python                    3.6.10               hcf32534_1
pyyaml                    3.12                     pypi_0    pypi
readline                  8.0                  he28a2e2_2    conda-forge
requests                  2.24.0                   pypi_0    pypi
requests-oauthlib         1.3.0                    pypi_0    pypi
rsa                       4.6                      pypi_0    pypi
scipy                     1.4.1                    pypi_0    pypi
setuptools                49.2.0                   py36_0
six                       1.15.0                   pypi_0    pypi
sqlite                    3.32.3               hcee41ef_1    conda-forge
tensorboard               2.3.0                    pypi_0    pypi
tensorboard-plugin-wit    1.7.0                    pypi_0    pypi
tensorflow                2.3.0                    pypi_0    pypi
tensorflow-estimator      2.3.0                    pypi_0    pypi
tensorflow-gpu            2.2.0                    pypi_0    pypi
tensorflow-hub            0.8.0                    pypi_0    pypi
termcolor                 1.1.0                    pypi_0    pypi
tk                        8.6.10               hed695b0_0    conda-forge
urllib3                   1.25.10                  pypi_0    pypi
werkzeug                  1.0.1                    pypi_0    pypi
wheel                     0.34.2                     py_1    conda-forge
wrapt                     1.12.1                   pypi_0    pypi
xz                        5.2.5                h516909a_1    conda-forge
zipp                      3.1.0                    pypi_0    pypi
zlib                      1.2.11            h516909a_1006    conda-forge

Categories: DeepLearning

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x