How to make Anaconda work behind HTTP proxy (not https)?

会有一股神秘感。 提交于 2019-12-29 05:46:05

问题


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:password@corp.com:8080
https_proxy: https://domain\username:password@corp.com:8080

or just

http_proxy: http://server\username:password@corp.com: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.


回答1:


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



回答2:


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.




回答3:


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:pass@corp.com: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




回答4:


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:

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.




回答5:


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.




回答6:


Worked for me with certificate yourcertname.pem: https://aafaqueabdullah.wordpress.com/2017/04/10/ssl-authentication/



来源:https://stackoverflow.com/questions/36729023/how-to-make-anaconda-work-behind-http-proxy-not-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!