mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.85k stars 353 forks source link

Error or warning? Should we load channels listed in the installed packages? #1924

Open jaimergp opened 2 years ago

jaimergp commented 2 years ago

Let's say we have the following situation:

  1. condarc says channels: [defaults]
  2. The user created an environment with mamba create -n my_env conda-forge::xz python. As a result, most packages come from defaults, but xz comes from conda-forge.
  3. In a future step, the user installs something else on my_env, without specifying conda-forge as a channel; e.g. conda install pytest

In this situation, libmamba will print a red error message to stderr:

libmamba Selected channel specific (or force-reinstall) job, but package is not available from channel. Solve job will fail.

The message is accurate, because xz might have an update on conda-forge but we can't tell because the user didn't include conda-forge in the channel list. Interestingly, this doesn't lead to an actual error. It's more of a (too loud?) warning.

We can avoid this message by making sure that the channels returned by PrefixData are also included in the repodata download list. See PR for conda-libmamba-solver here as a potential implementation idea for mamba.

The question is more along of the lines of: should we actually do this? conda/conda source does mention this in the comments, raising concerns about expired tokens or auth. If we do it, is it going to imply too much of an overhead? Is it really necessary?

The other question is whether the libmamba error message below should be downgraded to a warning instead, to cause less alarming feedback from users.

https://github.com/mamba-org/mamba/blob/32e47ae7febb760be255e0d424bf1f9bb84b1e87/libmamba/src/core/solver.cpp#L117-L118

Thanks!

jaimergp commented 1 year ago

Is it safe to assume that this warning is now gone after #2433? @AntoinePrv

AntoinePrv commented 1 year ago

Looks like the current behavior is that the channel is not reloaded (leading to update/install not fetching this data), and there is no warning about it. Installing new packages seems to work if there is no conflict with the existing one. Updates do not fetch more recent data from that channel leading to a potential noop.

Not sure what should be the desired behavior, probably reloading that channel, and including it in the solv data. Atlernatively we should write some message (maybe not through the log).

jaimergp commented 1 year ago

For context: