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

micromamba2: base_url and channel are mangled in micromamba list --json #3480

Closed
maresb opened this issue Sep 28, 2024 · 5 comments · Fixed by #3488
Closed

micromamba2: base_url and channel are mangled in micromamba list --json #3480

maresb opened this issue Sep 28, 2024 · 5 comments · Fixed by #3488
Assignees
Labels
type::bug Something isn't working

Comments

@maresb
Copy link
Contributor

maresb commented Sep 28, 2024

Note the difference below in base_url and channel. This leads to a failure in the conda-lock CI conda/conda-lock#713

Run

micromamba list --json

A typical entry with micromamba 1.5.10

    {
        "base_url": "https://conda.anaconda.org/conda-forge",
        "build_number": 0,
        "build_string": "ha6fb4c9_0",
        "channel": "conda-forge",
        "dist_name": "zstd-1.5.6-ha6fb4c9_0",
        "name": "zstd",
        "platform": "linux-64",
        "version": "1.5.6"
    }

A typical entry with micromamba 2.0.0

    {
        "base_url": "https://conda.anaconda.org/conda-forge/linux-64/zstd-1.5.6-ha6fb4c9_0.conda",
        "build_number": 0,
        "build_string": "ha6fb4c9_0",
        "channel": "conda-forge/linux-64/zstd-1.5.6-ha6fb4c9_0.conda",
        "dist_name": "zstd-1.5.6-ha6fb4c9_0",
        "name": "zstd",
        "platform": "linux-64",
        "version": "1.5.6"
    }

I think the output from 1.5.10 of base_url and channel is correct, while the output from 2.0.0 is incorrect.

@maresb
Copy link
Contributor Author

maresb commented Oct 2, 2024

Thanks so much @Hind-M!!!

@maresb
Copy link
Contributor Author

maresb commented Nov 7, 2024

Hey @Hind-M, I am still having trouble with this as it relates to conda-lock.

I have noticed that there is different behavior of the output depending on whether or not a package can be found in the cache the fn of the package's conda-meta entry contains the extension.

If fn omits the extension (like dist_name here):

    {
        "base_url": "https://conda.anaconda.org/conda-forge/linux-64/xz-5.2.5-h516909a_1.tar.bz2",
        "build_number": 1,
        "build_string": "h516909a_1",
        "channel": "conda-forge/linux-64/xz-5.2.5-h516909a_1.tar.bz2",
        "dist_name": "xz-5.2.5-h516909a_1",
        "name": "xz",
        "platform": "linux-64",
        "version": "5.2.5"
    },

If fn contains the extension so that url ends with fn, then we see the desired:

    {
        "base_url": "https://conda.anaconda.org/conda-forge",
        "build_number": 0,
        "build_string": "h166bdaf_0",
        "channel": "conda-forge",
        "dist_name": "xz-5.2.6-h166bdaf_0",
        "name": "xz",
        "platform": "linux-64",
        "version": "5.2.6"
    },

I don't know under which conditions the fn parameter omits the extension. It might be a legacy behavior?

@maresb
Copy link
Contributor Author

maresb commented Nov 7, 2024

Sorry, I'm struggling to come up with a MWE using the mambaorg/micromamba:2.0.2 Docker image. Not sure what's going on, I may need to investigate further.

@maresb
Copy link
Contributor Author

maresb commented Nov 7, 2024

Hello @Hind-M, here is a MWE via Docker illustrating the differences in output both with and without the file extension in the repodata fn. (I realized it's not about being in the cache or not, and edited my previous message accordingly.)

FROM mambaorg/micromamba:2.0.2

RUN micromamba install -c conda-forge -y xz=5.2.6

RUN micromamba list --json > with-extension.json

RUN sed -i 's/"fn": "xz-5.2.6-h166bdaf_0.tar.bz2",/"fn": "xz-5.2.6-h166bdaf_0",/' /opt/conda/conda-meta/xz-5.2.6-h166bdaf_0.json

RUN micromamba list --json > without-extension.json
docker build -t mamba-mwe-3480 .
docker run --rm -it mamba-mwe-3480 diff with-extension.json without-extension.json
53c53
<         "base_url": "https://conda.anaconda.org/conda-forge",
---
>         "base_url": "https://conda.anaconda.org/conda-forge/linux-64/xz-5.2.6-h166bdaf_0.tar.bz2",
56c56
<         "channel": "conda-forge",
---
>         "channel": "conda-forge/linux-64/xz-5.2.6-h166bdaf_0.tar.bz2",

@maresb
Copy link
Contributor Author

maresb commented Nov 7, 2024

Hey, apologies for the noise. My recent messages were erroneous, so please disregard.

(I tried to determine the conditions under which the extension should be omitted from fn, and I think this was due to a bug in conda-lock rather than the handling of some legacy behavior. 🤦‍♂️)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants