LoginSignup
15
16

More than 3 years have passed since last update.

anacondaでcondaするときにHTTPErrorが出るのそれproxyの問題じゃない??

Last updated at Posted at 2019-06-27

それproxyが悪さしてるんじゃない?

$ conda install -c anaconda pydot -y
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(.......

別にインターネットはhttp://anaconda.com をブロックしているわけでもない.
proxyは設定しているはずなのにcondaのインストールが通らない…….

もしかして:proxy

設定してると思いきや設定してないことがある
謎のHTTPErrorに悩まされている場合は,一度.condarcファイルを確認してほしい.

proxy設定が別にあるってマジ?

anacondaでは環境設定とは別に,condaとしてproxyを設定する必要があるみたい.
なんだそのクソ仕様

.condarcを探す or 作る

anacondaの設定ファイル.condarcにproxyの設定を書き込む.
anacondaのルート直下に作るのが正しい.
windowsであれば通常ユーザールートの直下にAnaconda3のディレクトリC:\Users\[ユーザー名]\Anaconda3があるのでそこに.condarcを作るか,すでにあれば追記する.
Unix系OSは/opt/conda/の下に作るか追記する.

無ければ適当なエディタ1で作成してください.

.condarcを記述する

.condarc
proxy_servers:
    http: http://[ユーザ名]@[ホスト名]:[ポート番号]
    https: http://[ユーザ名]@[ホスト名]:[ポート番号]

# 例 http: http:keisuke@hoge.jp:8080

dockerでanacondaを使っている場合は,毎回記述するのがめんどくさいのでDockerfileに直接

Dockerfile
RUN echo 'proxy_servers:\n        http: http://[ユーザ名]@[ホスト名]:[ポート番号]\n    https: http://[ユーザ名]@[ホスト名]:[ポート番号] >> /opt/conda/.condarc

とか書くといい.

終わりに

死ぬほどはまって時間を溶かした.
windowsのプロキシ設定をしているとhttpだけ書いてくれていたりする.なんだその微妙な仕様は

そもそもanacondaを使うやつが悪いって?それはそう……(研究室の都合です)


  1. メモ帳はエディタではない 

15
16
1

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
15
16