LoginSignup
1
1

More than 3 years have passed since last update.

pythonライブラリインストール proxy設定失敗時の対処

Last updated at Posted at 2019-10-18

◆環境:Anaconda3.7.3 (インストールはデフォルト設定。個別の設定変更なし。)

pip でエラーになる場合

参考:https://gammasoft.jp/support/pip-install-error/
対処: proxy指定してインストールする

pip install pypiwin32  --proxy=http://proxy01.xx.co.jp:8080
pip install pyinstaller --proxy=http://proxy01.xx.co.jp:8080

※anaconda環境では, pip installしないのが望ましいが、パッケージが見つからない場合は上記で。

conda install でエラーになる場合

◆現象:conda install コマンドでpythonライブラリを追加しようとすると、
   下記エラーでインストールに失敗する。

$conda install -c conda-forge pykriging

CondaHTTPError: HTTP 000 CONNECTION FAILED for url
 <~~~~~~> An HTTP error occurred when trying to retrieve this URL. 
HTTP errors are often intermittent, and a simple retry will get you on your way.
 If your current network has https://www.anaconda.con blocked, please file a support request with your network engineering team. 

ConnectTimeout(MaxRetryError(....... 

◆原因:anacondaのHTTP接続設定の不足

◆対処:anacondaの設定ファイル .condarc の変更

◆対処概要 以下2つの .condarc ファイルに設定追記 
(1) C:\Users\ユーザ名.condarc ※ 個人ユーザー用 
(2) C:\ProgramData\Anaconda3.condarc ※ 全体(管理者実行時)
  ※(2)はインストール先なので個人によって違うかもしれない。C:\ProgramData 、C:\Program Filesの下など 。

◆対処手順 
① 2ファイル .condarc ファイルの内容を下記のように proxy_servers: 以下を追記する

ssl_verify: true
channels:
  - defaults
proxy_servers:
    http: http://プロキシ名:ポート番号
    https: https://プロキシ名:ポート番号

↑※記載例:https: https://proxy01.xx.co.jp:8080

※ .condarcがない場合は新規作成。ファイル名が「.」始まりなのでGUIでは作れない。
1. condarc.txt」とかで新規ファイル作成 2. windowsコマンドプロンプトでコマンド実行「ren condarc.txt .condarc」
※インデントは空白4文字。(タブや、インデントなしでは書式エラーになる。)
※ proxyのアドレスはInternetExprolerの設定から流用した。
※ssl_vefity は不要やfalseでもいいのかもしれないが。Anaconda Promptでコマンド実行で先に追加していた。
conda config --set ssl_verify no

②Anaconda Prompt を管理者として起動する。 ①の設定でproxyが反映されているか確認。
以下コマンド実行。 結果表示で proxy: 以下にhttpとhttpsの設定があればOK。
conda config -show

③ Anaconda Prompt 管理者としてインストールコマンド実行
 例:conda install -c conda-forge pykriging

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1