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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnSolvable.explain_problems() fails if the conflict involves a pinned package and the request has flags.allow_uninstall=False #3267

Closed
3 tasks done
jaimergp opened this issue Apr 8, 2024 · 0 comments · Fixed by #3268

Comments

@jaimergp
Copy link
Contributor

jaimergp commented Apr 8, 2024

Troubleshooting docs

  • My problem is not solved in the Troubleshooting docs

Anaconda default channels

  • I do NOT use the Anaconda default channels (pkgs/* etc.)

How did you install Mamba?

Mambaforge or latest Miniforge

Search tried in issue tracker

Found invalid version predicate in

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

Not applicable

Describe your issue

If a conflict involves a pinned package (e.g. python) and flags.allow_uninstall=False, unsolvable.explain_problems() fails with libmambapy.bindings.specs.ParseError: Found invalid version predicate in "on python".

Reproducer with Python
import libmambapy

db = libmambapy.solver.libsolv.Database(
    libmambapy.specs.ChannelResolveParams(
        channel_alias=libmambapy.specs.CondaURL.parse("https://conda.anaconda.org")
    )
)
print("loading repodata")
repos = [
    db.add_repo_from_repodata_json(
        path="/opt/conda/pkgs/cache/d9d93fba.json",  # taken from the pkgs/cache
        url="https://conda.anaconda.org/conda-forge/linux-aarch64",
        channel_id="conda-forge",
    ),
    db.add_repo_from_repodata_json(
        path="/opt/conda/pkgs/cache/09cdf8bf.json",  # taken from the pkgs/cache
        url="https://conda.anaconda.org/conda-forge/noarch",
        channel_id="conda-forge",
    ),
]

Request = libmambapy.solver.Request
MatchSpec = libmambapy.specs.MatchSpec

print("crafting request...")
request = Request(
    jobs=[
        Request.Pin(MatchSpec.parse("python=3.12")),
        Request.Install(MatchSpec.parse("numpy=*=*py27*")),
    ],
    flags=Request.Flags(
        allow_downgrade=True,
        allow_uninstall=False,
        force_reinstall=False,
        keep_dependencies=True,
        keep_user_specs=True,
        order_request=False,  # we do this ourselves
        strict_repo_priority=True,
    ),
)

print("solving...")
solver = libmambapy.solver.libsolv.Solver()
outcome = solver.solve(db, request)
if isinstance(outcome, libmambapy.solver.libsolv.UnSolvable):
    print(outcome.explain_problems(db, libmambapy.Palette.no_color()))
else:
    print("OK!")

mamba info / micromamba info

libmamba version : 2.0.0
          mamba version : 2.0.0
           curl version : libcurl/8.7.1 OpenSSL/3.2.1 zlib/1.2.13 zstd/1.5.5 libssh2/1.11.0 nghttp2/1.58.0
     libarchive version : libarchive 3.7.2 zlib/1.2.13 liblzma/5.2.6 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.5.5
       envs directories : /root/.local/share/mamba/envs
          package cache : /root/.local/share/mamba/pkgs
                          /root/.mamba/pkgs
            environment : /opt/conda (active)
           env location : /opt/conda
      user config files : /root/.mambarc
 populated config files : /opt/conda/.condarc
       virtual packages : __unix=0=0
                          __linux=5.15.49=0
                          __glibc=2.31=0
                          __archspec=1=aarch64
               channels : https://conda.anaconda.org/conda-forge/linux-aarch64
                          https://conda.anaconda.org/conda-forge/noarch
       base environment : /root/.local/share/mamba
               platform : linux-aarch64

Logs

No response

environment.yml

No response

~/.condarc

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant