Using Anaconda behind a company proxy#
When using Anaconda with a company proxy, you may encounter an HTTP and SSL error due to custom security profiles managed by corporate IT departments.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/main/win-64/current_repodata.jsonElapsed: 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.com blocked, please file a support request with your network engineering team. ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000001B79FFE3278>, 'Connection to repo.anaconda.com timed out. (connect timeout=9.15)'))"))
There are 3 potential ways to resolve this. Start with updating the .condarc file before trying the other methods.
Update the .condarc file#
Anaconda recommends updating your .condarc file to include the
This is the preferred method because this will affect only conda and not the
system environment variables.
Read more about the .condarc file and using proxies.
proxy_servers: http: http://username:email@example.com:8080 https: https://username:firstname.lastname@example.org:8080
You can see if your proxy is set by running
conda info --all.
You can also resolve this error by updating the system environment variables. This can affect all CLI software across the whole system.
To change environment variables on Windows:
In the Start menu, search for “env”.
Select “Edit Environment Variables for your account”
Select “Environment Variables…”
Add two variables
https_proxyboth with the same value: http://proxy-XX:XXX
To change environment variables on macOS:
Check the current environment variable settings by running
printenvin the terminal.
To check a specific environment variable, use
Temporarily change the environment variables by running
export variable_name=variable_value. You can check if it’s there by running
conda info --all.
To change your environment variables on macOS permanently, review this guide.
To change environment variables on Linux:
To output the value of the environment variable from the shell, run
Read more about unsetting, listing, and persisting environment variables.
A .netrc file is an alternate way to accomplish the same goal of setting the
*_PROXY environment variables or configuring things only for conda in the
.condarc file. The risk in this approach is that changing the environment variables
here will affect the system settings as a whole.