Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report all missing packages from channel #101

Merged
merged 5 commits into from
Jan 27, 2023
Merged

Report all missing packages from channel #101

merged 5 commits into from
Jan 27, 2023

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Dec 23, 2022

Description

conda.exceptions has many classes to play with if packages are not found:

  • When the user asks for a package to be installed but this is not available in the chosen channels, conda raises PackagesNotFoundError. For the message to mention the offending channels, this exception class needs a channels kwarg. Otherwise, it'll default to "missing from target environment" messaging. We were missing this kwarg, so the messaging was wrong.
  • Additionally, it has PackageNotInstalledError, which takes a prefix kwarg too, and mentions it in the messaging. However, this only accepts a single package name 馃し

Fun fact: conda classic uses both, depending on the context, and there's no good reason imo. I'll submit an issue about this in conda/conda

This PR simply fixes our missing kwarg so the messaging is correct.

Before this PR:

$ conda create -n unused --dry-run pkg-does-not-exist --solver=libmamba
pkgs/r/noarch                                                 No change
pkgs/main/linux-64                                            No change
pkgs/main/noarch                                              No change
pkgs/r/linux-64                                               No change
Collect all metadata (repodata.json): done
Solving environment: failed
pkgs/main/linux-64                                          Using cache
pkgs/main/noarch                                            Using cache
pkgs/r/linux-64                                             Using cache
pkgs/r/noarch                                               Using cache
Collect all metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are missing from the target environment:
  - pkg-does-not-exist

After this PR:

$ conda create -n unused --dry-run pkg-does-not-exist --solver=libmamba

pkgs/main/linux-64                                            No change
pkgs/main/noarch                                              No change
pkgs/r/linux-64                                               No change
pkgs/r/noarch                                                 No change
Collect all metadata (repodata.json): done
Solving environment: failed
pkgs/main/linux-64                                          Using cache
pkgs/main/noarch                                            Using cache
pkgs/r/linux-64                                             Using cache
pkgs/r/noarch                                               Using cache
Collect all metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - pkg-does-not-exist

Current channels:

  - defaults

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

This closes #96.

(Note this output still suffers from the double attempt issue reported in #100)

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Dec 23, 2022
@jaimergp jaimergp marked this pull request as ready for review January 20, 2023 15:49
@jaimergp
Copy link
Contributor Author

@conda/conda-libmamba-solver - ready for review! <3

@jaimergp jaimergp requested a review from a team January 26, 2023 15:01
@jaimergp jaimergp merged commit 45c9849 into main Jan 27, 2023
@jaimergp jaimergp deleted the missing-pkgs branch January 27, 2023 09:52
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Jan 28, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed [bot] added once the contributor has signed the CLA locked [bot] locked due to inactivity
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Report all missing packages, not just one
3 participants