The situation
At work we have a private conda channel in our network that is used for some internal packages.
Since I do not want to type the channel location every time I install something via conda install
, I added it to condas default channels in .condarc
.
The problem
Obviously the channel is only available inside my company's network. When I am outside the network and want to install for example numpy
(so a normal package available on the conda default channel) I get the following error because the private channel is not available:
conda.exceptions.UnavailableInvalidChannel: The channel is not accessible or is invalid.
channel name: privateChannel
channel url: file://address/in/companys/network
error code: 404
independent from what package I want to install!
What I am looking for
An option to tell conda to ignore the UnavailableInvalidChannel
error or something similar that solves my problem. Because I do not want to edit my .condarc
every time I switch to another network...
Usually I am aware of, if I am going to install an internal package that I need the company's channel for so I would not mind if conda skips the internal channel silently or with a warning for everything else if it is not available. I just do not want conda to abort everything if it is not available.
Another small related question: Is there a way to define channel aliases? I am aware of channel-alias
but that just changes the default channel prefix.
More or less by accident I found the answer to my own question recently and do not want to keep it by myself.
To prevent conda to fail when a channel is not available during install/update of packages from other available channels you have to set the following parameter in your .condarc
file:
allow_non_channel_urls = True
Or instead of editing your .condarc
directly, you can type in your terminal:
conda config --set allow_non_channel_urls True
The parameter with the not very intuitive name allow_non_channel_urls
is not explained in the conda docs about using the .condarc
conda configuration file. But you can find it in their full .condarc
example here and nowhere else.
The official explanation is "Warn, but do not fail, when conda detects a channel url is not a valid channel". This means for example, that if the channel URL is simply not reachable from the network you are currently using (maybe you are outside of your companies network) conda will just print a warning instead of abort installing packages. This is exactly what I wanted!
The warning can look quite excessive because it is printed for every architecture (linux-32
, win-64
, osx-64
, noarch
, etc.)
Conda will still fail with an error if your package is not found on the available channels. But in that case you want conda to fail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With