简体   繁体   中英

Installing conda packages when not being logged in to my organizational network fails when using corporate's ssl-certificate

In order to be able to install conda and pip packages from within my organizational network I configured conda to use my corporate's .pem file using:

conda config --set ssl_verify <pathToMyFile>.pem

Everything works fine with downloading and installing packages but as soon as I am not logged in to the network (eg because I am working from home) I can't install any packages anymore. It seems that I have to be logged in to my corporate's network when using the respective .pem file.

Specifically I am getting the following error:

Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/linux-64/repodata.json>

This problem has already been discussed here where user @payala summed up the problem in the comment section:

Yes, but then this will only work while you are within your organization's network. If you are using a notebook and you exit the network, it will not work. What can be done that supports adding this certificate in addition to the ones already used by conda? – payala

One solution would be to follow the suggestion from user @user6020015 who says:

if you leave your organization's network, you can just comment out that line in.condarc with a # and uncomment when you return.

However, this seems very tedious to me, because I would have to comment and uncomment this line of code several times per week. Is there a solution to solve this?

I'd probably add some shorthand commands to the shell (eg, ~/.bashrc ), like...

function conda_work() { 
  conda config --set ssl_verify <pathToMyFile>.pem
}

function conda_play() {
  conda config --remove-key ssl_verify
}

to quickly toggle the setting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM