4

I am trying to install conda packages/create environments behind a corporate firewall

On another machine, I managed to install packages from conda default channels by setting the HTTP/HTTPS proxies and ssl_verify: False in conda config.

However, I am now getting ProxyError: Conda cannot proceed due to an error in your proxy configuration. Check for typos and other configuration errors in any '.netrc' file in your home directory, any environment variables ending in '_PROXY', and any other system-wide proxy configuration settings.

I have verified that conda is not accessing any .netrc file through conda info

.condarc:

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://abc.cde.local:XXXX
    https: https://abc.cde.local:XXXX


ssl_verify: False

Here are the steps I have tried to resolve my issue:

  1. I have verified that the proxy URLs are correct and can make outgoing requests through these URLs
  2. I have tried to set the two settings both through conda config --set and .condarc
  3. I have tried to set the proxies through environmental variables

I cannot make changes to Windows proxy settings or do anything that requires any admin permissions.

Does anyone have any experience with this?

6
  • Please share your configuration and related environment variables so that we don't have to guess
    – frippe
    Commented Oct 18, 2021 at 8:08
  • Updated with the config and current environment variables
    – Zhu Weiji
    Commented Oct 18, 2021 at 8:22
  • Could you please unmask the proxy config? Replace your company url and, if used, username and password, with example values so that the format becomes clear. Also, by "relevant environment variables", I meant what your http_proxy and https_proxy look like, so please update your post with only those two variables (suitably masked, without hiding their format/structure) and remove the unnecessary dump of all but your http variables.
    – frippe
    Commented Oct 18, 2021 at 8:28
  • I have added the url format and removed the env vars. I am not setting the https_proxy env variable manually or have it configured at this time, although I have tried setting it before but that was no help. I configured it using the same proxy url I use in .condarc, and I have tested the proxy url and confirmed it is working
    – Zhu Weiji
    Commented Oct 18, 2021 at 8:39
  • I'm not using conda, but I'm not so sure conda info will give you all details (such as whether it will use .netrc or not). I can't spot any issues with the proxy config in your .condarc, so I'd try removing (or comment out, rather) the proxy section from that file to see if you get the same error. If you do, you know the issue lies somewhere else, but if you don't, you know that those are the offending lines (whatever the reason).
    – frippe
    Commented Oct 18, 2021 at 9:00

3 Answers 3

5

If you know your condarc file is correct, on Windows you need to make sure that your environment variables are "http_proxy" and https_proxy", lowercase.

Also, most proxies use an unencrypted traffic to the proxy. So make sure the URLs to your proxy are both http://

Finally, when you change your enviroment variables in Windows you must start a new powershell session for the changes to take affect.

This and the correct conda RC file solved it for me.

1
  • Yes, this is the crux - Note the difference between http and https
    – dave9000
    Commented Sep 12, 2022 at 14:26
1

For me, I just deactivate from the conda base env and the proxy error disappeared.

1

I experienced this issue accidentialy when upgrading urllib to version >= 1.26 in the conda base environment (as a dependency).

The fix is to change the https scheme to http:

proxy_servers:
    http: http://abc.cde.local:XXXX
    # https: https://abc.cde.local:XXXX
    https: http://abc.cde.local:XXXX

This works fine for me.

Sources: I found the hint regarding the urllib version here: (https://github.com/conda/conda/issues/9497#issuecomment-835862194) and the explanation of the urllib developer here (https://github.com/pypa/pip/issues/9216#issuecomment-741836058).

Not the answer you're looking for? Browse other questions tagged or ask your own question.