19
votes

I'm having trouble working with Anaconda behind a proxy at work.

When I have have the following environment variables:

http_proxy: http://domain\username:[email protected]:8080
https_proxy: https://domain\username:[email protected]:8080

or just

http_proxy: http://server\username:[email protected]:8080

set up then git works. But Anaconda does not work. I'm trying to run

conda update conda

and I get:

Could not connect to https://repo.continuum.io/pkgs....
Could not connect to https://repo.continuum.io/pkgs....

Does Anaconda not work with http? and requires an https proxy? Because I'm thinking my company may not have an https proxy server setup (I've only seen them use http). or sometimes I get the error:

File "c\Anaconda2\", line 340, in wait
    waiter.acquire()
KeyboardInterrupt
Could not connect to https://repo.continuum.io/pkgs....
Could not connect to https://repo.continuum.io/pkgs....

I'm using Windows 7.

8

8 Answers

43
votes

you need to create a .condarc file in you Windows user area:

C:\Users\<username>\

The file should contain:

channels:
- defaults

# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True

proxy_servers:
    http: http://proxy.yourorg.org:port
    https: http://proxy.yourorg.org:port


ssl_verify: False
4
votes

If the above solutions didnt work for you, you can try this.

Go to your PC settings and then to proxy. Just give the proxy setting globally for your pc. When I did it, it worked for me.

enter image description here

3
votes

I went on to add HTTP_proxy and HTTPS proxy in the environment variable. The format used was "username:password@proxy_name:port". I then reopened Anaconda prompt. Type "set" to verify the added variables are present in Anaconda environment. Now you can type "spyder" in the Ananconda prompt. This setting worked for me.

Initially I had tried setting the ".condarc file with the proxy parameters and tried "conda update conda" to no luck.

2
votes

The above solution of modifying .condarc doesn't work for me. However I succeed by updating the environment variables in Advanced System Settings in the format https://user:[email protected]:8080.

If your password contains special characters, you need escape them as described in Percent-encoding reserved characters , on Wikipedia. https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters

2
votes

The below worked for me to permanently set my proxies for Anaconda:

Go to C:/ProgramData/Anaconda3/etc/

If it doesn’t already have a conda folder, create it.

If it doesn’t already have the folders activate.d and deactive.d, create them.

Also create env_vars.bat in both folders. Your end structure should look like the snapshot below:

enter image description here

In env_vars.bat in activate.d, paste the following (change it to your own proxies):

set HTTP_PROXY=http://xx.xx.x.xx:xxxx/
set FTP_PROXY=http://xx.xx.x.xx:xxxx/
set HTTPS_PROXY=https://xx.xx.xxx.xx:xxxx/

In env_vars.bat in deactivate.d, paste the following (leave the variables blank):

set HTTP_PROXY=
set FTP_PROXY=
set HTTPS_PROXY=

Close and reopen your Anaconda Prompt to activate the changes.

2
votes

See my answer in another post:

The best way I settled with is to set proxy environment variables right before using conda or pip install/update commands. Simply run:

set HTTP_PROXY=http://username:password@proxy_url:port

For example, your actual command could be like

set HTTP_PROXY=http://yourname:[email protected]_company.com:8080

If your company uses https proxy, then also

set HTTPS_PROXY=https://username:password@proxy_url:port

Once you exit Anaconda prompt then this setting is gone, so your username/password won't be saved after the session.

I didn't choose other methods mentioned in Anaconda documentation or some other sources, because they all require hardcoding of username/password into

  • Windows environment variables (also this requires restart of Anaconda prompt for the first time)
  • Conda .condarc or .netrc configuration files (also this won't work for PIP)
  • A batch/script file loaded while starting Anaconda prompt (also this might require configuring the path)

All of these are unsafe and will require constant update later. And if you forget where to update? More troubleshooting will come your way...

0
votes

This method worked for me:

Copy files libcrypto-1_1-x64.dll and libssl-1_1-x64.dll from the directory ./Anaconda3/Library/bin/ to ./Anaconda3/DLLs.

Hope it answers your question