본문 바로가기

머신러닝 & 텐서플로 & 파이썬

Conda 설치, SSL error 대응

반응형

Conda 설치 

 

여기에서 각 OS에 맞는 anaconda를 설치하세요.

https://www.anaconda.com/distribution/

 

Anaconda Python/R Distribution - Free Download

Anaconda Distribution is the world's most popular Python data science platform. Download the free version to access over 1500 data science packages and manage libraries and dependencies with Conda.

www.anaconda.com

 

설치후 shell을 실행하면, (base) 로 conda가 활성화 되어있습니다.

이를 제거 하려면,

$ conda config --set auto_activate_base false

이렇게 설정 하시면 됩니다.

 

사용 방법

 

conda 설치 후에 가상 환경을 만듭니다.

 

$ conda create -n torch python=3.6  # torch라는 가상 환경을 만듭니다.

 

(torch) $ conda activate torch  # 가상환경 torch를 activate 시킵니다.

 

(torch) $ conda deactivate # 가상환경 torch를 deactivate 시킵니다.

 

 

 

 

 

 

[출처] [Ubuntu18.04 환경설정] Anaconda3 설치 및 가상환경 생성|작성자 DL연구생

 

 

Trouble shooting #1

 

 

conda 설치할때, 방화벽이 있거나 보안이 철저한 환경에서 셋업을 할때는 아래와 같은 설정을 해줘야 합니다.

 

이런 정보들 찾아서 시도해보고 다시 정리하고 하는 것은 정말 많은 시간을 낭비하게 되네요.

회사들 마다 보안 환경들이 모두 다르기 때문에 더더욱 시간 허비가 심하죠.

 

그래서 도움이 될까 해서 정리 했습니다.

 

 

SSL 또는 Proxy error

ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/linux-64/current_repodata.json (Caused by ConnectTimeoutError(, 'Connection to repo.anaconda.com timed out. (connect timeout=9.15)'))")) 

 

 

프록시 설정을 .condarc 파일 에서 하기

ssl_verify: <my crt file>.crt

proxy_servers:
      http: http://<proxy server url : port> 
      https: https://<proxy server url : port> 

 

 

 

 

다른 방법

cert file 설치을 pip 의 certi file 로 설정하는 방법

 

pip config set global.cert path/to/ca-bundle.crt
pip config list conda config --set ssl_verify path/to/ca-bundle.crt
conda config --show ssl_verify# Bonus while we are here...
git config --global http.sslVerify true
git config --global http.sslCAInfo path/to/ca-bundle.crt

 

 

패키기 설치(Package install)

 

conda install [pkgname]

 

 

 

[참고]

conda configuration guide

https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#config-proxy