mamba-org / mamba

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

`mamba env export --json --from-history` is broken in v2 #3582

Closed mathbunnyru closed 2 weeks ago

mathbunnyru commented 3 weeks ago

Troubleshooting docs

Anaconda default channels

How did you install Mamba?

Micromamba

Search tried in issue tracker

mamba, env, export, from-history

Latest version of Mamba

Tried in Conda?

I didn't try

Describe your issue

When I run mamba env export --json --from-history it produces invalid json file:

{
  "channels": [
    "conda-forge"
  ],
  "dependencies": [
    "jupyter_core",
    "mamba",
    "python=3.12",
  ],
  "name": "base",
  "prefix": "/opt/conda"
}

Note: --from-history flag is important here, without it everything is ok, the json is invalid due to , in the last element of dependencies.

mamba info / micromamba info

libmamba version : 2.0.3
          mamba version : 2.0.3
           curl version : libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 zstd/1.5.6 libssh2/1.11.0 nghttp2/1.64.0
     libarchive version : libarchive 3.7.4 zlib/1.2.13 liblzma/5.2.6 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.5.6
       envs directories : /opt/conda/envs
          package cache : /opt/conda/pkgs
                          /home/jovyan/.mamba/pkgs
            environment : base
           env location : /opt/conda
      user config files : /home/jovyan/.mambarc
 populated config files : /opt/conda/.condarc
       virtual packages : __unix=0=0
                          __linux=6.10.11=0
                          __glibc=2.39=0
                          __archspec=1=aarch64
               channels : https://conda.anaconda.org/conda-forge/linux-aarch64
                          https://conda.anaconda.org/conda-forge/noarch
       base environment : /opt/conda
               platform : linux-aarch64

Logs

No response

environment.yml

No response

~/.condarc

No response

mathbunnyru commented 3 weeks ago

Related to: https://github.com/mamba-org/mamba/issues/3492

The --json output was added in https://github.com/mamba-org/mamba/pull/3559/files

@jjerphan you might want to take a look here

mathbunnyru commented 3 weeks ago

One more bug in the --json output: when running with --json we're only printing channels when it's not empty (https://github.com/mamba-org/mamba/pull/3559/files#diff-da24ec78e2ee34afe1e53af5b3ba02e9f49b61efa2a54dac78e201b9f536e0b2R232), but without --json we're always printing it:.

We should always print it channels no matter if it's empty or not.

maresb commented 3 weeks ago

I'm running into a different problem of a very similar style in #3583