Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable proxy servers with anaconda python

Tags:

We are trying to get the conda install (on windows 8) to work behind a firewall via a proxy server. Currently, we are able to use pip to install packages while on our company network by using this at the command prompt:

pip install pandas --proxy=http://abc.def.xyz.com:1234 

No passwords need to be specified, just the proxy server and port. The conda documentation states that proxy servers are possible:

# Proxy settings: http://[username]:[password]@[server]:[port] proxy_servers:     http: http://user:[email protected]:8080     https: https://user:[email protected]:8080 

I have tried this with various combinations to see if I can get it to work with or without putting in my username and password.

# formats tried: http: http://user:[email protected]:1234 http: http://abc.def.xyz.com:1234 

I cannot seem to get it to work. Tried various combinations of quoting things too (passwords have special chars). Also tried with and without the domain\user.

I can see under the hood, conda is using urlib3 (while pip may be using urlib proxy handler?). Note that having your username and password in a file is generally frowned upon.

I know we could set up our own http or file location channel and put all the packages there and add the channel to the .condarc config settings. However I would prefer not to have to manage a repository of packages and versions locally.

So.... is there a way to specify, in the .condarc file the proxy server and port (without user and password) so that conda install works behind a firewall just like pip install on the command line? Or even an inline call like pip has and works... something like:

conda install pandas --proxy=abc.def.xyz.com:1234 

Thanks in advance...

PS: I really love conda. I spent last weekend setting up many virtual environments on my home PC. Documentation was great and everything worked flawlessly. Overall, much better than pip... if only we could only get this to work inside our company :)

like image 618
Randall Goodwin Avatar asked Mar 25 '15 22:03

Randall Goodwin


People also ask

Where do I put Condarc file?

To select channels for a single environment, put a . condarc file in the root directory of that environment (or use the --env option when using conda config ).

What is the Condarc file?

condarc , is an optional runtime configuration file that allows advanced users to configure various aspects of conda, such as which channels it searches for packages, proxy settings, and environment directories.


1 Answers

Well, this is embarrassing, but good news. I solved my problem with one more attempt at a change in the condarc file.

https: https://abc.def.xyz.com:1234 

I guess pip worked ok with regular http, while conda's addresses are all https sites:

https://repo.continuum.io/pkgs/free/win-64/ 

I should have caught that!

Well, I am now just happy that we have a solution to use conda behind our firewall, and without needing a user and password. Awesome!

like image 123
Randall Goodwin Avatar answered Oct 02 '22 00:10

Randall Goodwin