2017년 9월 15일 금요일

Minsky 서버에 Anaconda installer의 full package 설치하기

올 3월까지만 해도 Continuum사의 Anaconda installer가 Minsky의 아키텍처인 ppc64le 환경에서는 full package로는 없었고, Miniconda installer만 있었습니다.   그런데 그 사이에 ppc64le용 Anaconda installer의 full package가 이미 나왔네요.

https://repo.continuum.io/archive/

Filename Size Last Modified MD5
Anaconda2-4.4.0.1-Linux-ppc64le.sh 271.4M 2017-07-26 16:10:02 ce166de6f116acd08cd313f9c55c04d6
Anaconda3-4.4.0.1-Linux-ppc64le.sh 285.6M 2017-07-26 16:08:42 fe7c87abd9fd70dc0cb4f83cc22d336f


설치는 아래와 같이 하시면 됩니다.  Python2.7 환경에서는 아래와 같이 Anaconda2-4.4.0.1-Linux-ppc64le.sh를 받으시면 되고, Python3 환경에서는 Anaconda3-4.4.0.1-Linux-ppc64le.sh를 받으시면 됩니다.  일단 둘다 받아서 설치하시는 것이 좋습니다.  여기서는 Anaconda2에 대한 부분만 써놓습니다.

u0017649@sys-89075:~$ wget https://repo.continuum.io/archive/Anaconda2-4.4.0.1-Linux-ppc64le.sh
--2017-09-14 21:42:44--  https://repo.continuum.io/archive/Anaconda2-4.4.0.1-Linux-ppc64le.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.16.18.10, 104.16.19.10, 2400:cb00:2048:1::6810:120a, ...
Connecting to repo.continuum.io (repo.continuum.io)|104.16.18.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 284629257 (271M) [application/x-sh]
Saving to: ‘Anaconda2-4.4.0.1-Linux-ppc64le.sh’

Anaconda2-4.4.0.1-L 100%[===================>] 271.44M  16.7MB/s    in 17s

2017-09-14 21:43:01 (16.4 MB/s) - ‘Anaconda2-4.4.0.1-Linux-ppc64le.sh’ saved [284629257/284629257]


여러 user가 함께 쓰는 서버 환경에 Anaconda를 설치할 때는, 해당 user의 home directory에 설치하면 다른 user들이 쓸 수가 없지요.  따라서 일단은 /opt/anaconda2에 설치해놓고 user별로 clone을 해서 사용하시는 것이 좋습니다.   물론 /opt directory에 설치하려면 sudo 권한이 있어야 합니다.

u0017649@sys-89075:~$ chmod u+x Anaconda2-4.4.0.1-Linux-ppc64le.sh

u0017649@sys-89075:~$ sudo ./Anaconda2-4.4.0.1-Linux-ppc64le.sh

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

Anaconda2 will now be installed into this location:
/home/u0017649/anaconda2

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

[/home/u0017649/anaconda2] >>> /opt/anaconda2

...
installing: zict-0.1.2-py27_0 ...
installing: zlib-1.2.8-3 ...
installing: anaconda-4.4.0-np112py27_0 ...
installing: conda-4.3.21-py27_0 ...
installing: conda-env-2.6.0-0 ...
Python 2.7.13 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Do you wish the installer to prepend the Anaconda2 install location
to PATH in your /home/u0017649/.bashrc ? [yes|no]
[no] >>> yes

Prepending PATH=/opt/anaconda2/bin to PATH in /home/u0017649/.bashrc
A backup will be made to: /home/u0017649/.bashrc-anaconda2.bak

For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda2!

Share your notebooks and packages on Anaconda Cloud!
Sign up for free: https://anaconda.org


이제 환경변수를 적용하고, conda install을 해봅니다.

u0017649@sys-89075:~$ . ./.bashrc

u0017649@sys-89075:~$ env | grep PATH
PATH=/opt/anaconda2/bin:/home/u0017649/bin:/home/u0017649/.local/bin:/opt/ibm/xlC/current/bin:/opt/ibm/xlf/current/bin:/opt/at10.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

u0017649@sys-89075:~$ conda install scikit-learn
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /opt/anaconda2:

The following packages will be UPDATED:

    scikit-learn: 0.18.1-np112py27_1 --> 0.19.0-np112py27_0

Proceed ([y]/n)? y


CondaIOError: Missing write permissions in: /opt/anaconda2
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/opt/anaconda2'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone="/opt/anaconda2"


보시다시피 /opt/anaconda2에 대해서 일반 user들은 write 권한이 없기 때문에 error가 납니다.   그래서 각 user별로 cloning을 해서 사용하는 것입니다.  아래와 같이 하시면 됩니다.

u0017649@sys-89075:~$ conda create -n anaconda2 --clone="/opt/anaconda2"
Source:      /opt/anaconda2
Destination: /home/u0017649/.conda/envs/anaconda2
The following packages cannot be cloned out of the root environment:
 - conda-4.3.21-py27_0
 - conda-env-2.6.0-0
Packages: 186
Files: 11
#
# To activate this environment, use:
# > source activate anaconda2
#
# To deactivate this environment, use:
# > source deactivate anaconda2
#

이제 cloning 환경으로 들어가서 위에서 실패했던 scikit-learn 패키지의 설치를 다시 해보겠습니다.

u0017649@sys-89075:~$ source activate anaconda2
(anaconda2) u0017649@sys-89075:~$ conda install scikit-learn

이건 잘 됩니다.  이것이 잘 되는 이유는 다음과 같이 각 user의 home directory 밑인 ~/.conda/envs에 cloning을 해놓고 쓰기 때문입니다.   물론 이는 disk 저장공간을 사용하는 작업이므로, 많은 user들이 각자 모두 cloning을 할 경우 disk 공간의 낭비가 꽤 있게 되는 문제가 있긴 합니다.  가령 Anaconda2를 1번 clone할 때마다 약 1.1 GB의 공간이 소모됩니다.  따라서 모든 user가 일괄적으로 이렇게 cloning을 할 필요는 없고, 정말 꼭 자신만의 변경된 package 환경을 가져야 할 경우에만 하실 것을 권고합니다.

(anaconda2) u0017649@sys-89075:~/.conda/envs/anaconda2$ du -sm .
1135    .

댓글 1개:

  1. 777권한을 /opt/anaconda2에 주면 문제 없이 실행 되더군요, ubuntu 16.04 사용 중이며 $sudo su 를 이용해 root로 접속하여 설치 진행 하였습니다. 설치 완료 후 #chmod -R 777 anaconda2 명령어를 이용해 모드를 변경하였고 vi /etc/bash.bashrc 에 export PATH="/opt/anaconda2/bin:$PATH"를 이용하여 환경변수 추가 해주면 일반 사용자도 conda install 등을 사용 할 수 있었습니다.

    답글삭제