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

Micromamba is not silent on errors even when you pass --quiet #3763

Open
3 tasks done
simon-ess opened this issue Jan 22, 2025 · 4 comments
Open
3 tasks done

Micromamba is not silent on errors even when you pass --quiet #3763

simon-ess opened this issue Jan 22, 2025 · 4 comments
Labels
--json Problems with --json type::bug Something isn't working

Comments

@simon-ess
Copy link

simon-ess commented Jan 22, 2025

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?

Micromamba

Search tried in issue tracker

quiet

Latest version of Mamba

  • My problem is not solved with the latest version

Tried in Conda?

I do not have this problem with Conda, just with Mamba

Describe your issue

Micromamba really likes to tell you when something has gone wrong (see for example my previous issue #3636), even if you tell it not to. Running a command such as

$ micromamba list --quiet --json -n not_an_environment

yields the extremely verbose, non-json output

info     libmamba ****************** Backtrace Start ******************
debug    libmamba Loading configuration
trace    libmamba Compute configurable 'create_base'
trace    libmamba Compute configurable 'no_env'
trace    libmamba Compute configurable 'no_rc'
trace    libmamba Compute configurable 'rc_files'
trace    libmamba Compute configurable 'root_prefix'
trace    libmamba Get RC files configuration from locations up to HomeDir
trace    libmamba Configuration not found at '/root/.mambarc'
trace    libmamba Configuration not found at '/root/.mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.mamba/mambarc'
trace    libmamba Configuration not found at '/root/.mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.condarc'
trace    libmamba Configuration not found at '/root/.conda/condarc.d'
trace    libmamba Configuration not found at '/root/.conda/condarc'
trace    libmamba Configuration not found at '/root/.conda/.condarc'
trace    libmamba Configuration not found at '/root/.config/conda/condarc.d'
trace    libmamba Configuration not found at '/root/.config/conda/condarc'
trace    libmamba Configuration not found at '/root/.config/conda/.condarc'
trace    libmamba Configuration not found at '/root/micromamba/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/condarc'
trace    libmamba Configuration not found at '/root/micromamba/.condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.mambarc'
trace    libmamba Configuration not found at '/var/lib/conda/condarc.d/'
trace    libmamba Configuration not found at '/var/lib/conda/condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.condarc'
trace    libmamba Configuration found at '/etc/conda/.mambarc'
trace    libmamba Configuration not found at '/etc/conda/condarc.d/'
trace    libmamba Configuration not found at '/etc/conda/condarc'
trace    libmamba Configuration not found at '/etc/conda/.condarc'
trace    libmamba Update configurable 'no_env'
trace    libmamba Compute configurable 'envs_dirs'
trace    libmamba Compute configurable 'file_specs'
trace    libmamba Compute configurable 'spec_file_env_name'
trace    libmamba Compute configurable 'env_name'
trace    libmamba Compute configurable 'use_default_prefix_fallback'
trace    libmamba Compute configurable 'use_root_prefix_fallback'
trace    libmamba Compute configurable 'use_target_prefix_fallback'
trace    libmamba Compute configurable 'target_prefix'
trace    libmamba Get RC files configuration from locations up to TargetPrefix
trace    libmamba Configuration not found at '/root/micromamba/envs/food/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/condarc'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/.condarc'
trace    libmamba Configuration not found at '/root/.mambarc'
trace    libmamba Configuration not found at '/root/.mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.mamba/mambarc'
trace    libmamba Configuration not found at '/root/.mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.condarc'
trace    libmamba Configuration not found at '/root/.conda/condarc.d'
trace    libmamba Configuration not found at '/root/.conda/condarc'
trace    libmamba Configuration not found at '/root/.conda/.condarc'
trace    libmamba Configuration not found at '/root/.config/conda/condarc.d'
trace    libmamba Configuration not found at '/root/.config/conda/condarc'
trace    libmamba Configuration not found at '/root/.config/conda/.condarc'
trace    libmamba Configuration not found at '/root/micromamba/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/condarc'
trace    libmamba Configuration not found at '/root/micromamba/.condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.mambarc'
trace    libmamba Configuration not found at '/var/lib/conda/condarc.d/'
trace    libmamba Configuration not found at '/var/lib/conda/condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.condarc'
trace    libmamba Configuration found at '/etc/conda/.mambarc'
trace    libmamba Configuration not found at '/etc/conda/condarc.d/'
trace    libmamba Configuration not found at '/etc/conda/condarc'
trace    libmamba Configuration not found at '/etc/conda/.condarc'
trace    libmamba Update configurable 'no_env'
trace    libmamba Compute configurable 'relocate_prefix'
trace    libmamba Compute configurable 'target_prefix_checks'
error    libmamba No prefix found at: /root/micromamba/envs/food
error    libmamba Environment must first be created with "micromamba create -n {env_name} ..."
critical libmamba Aborting.
info     libmamba ****************** Backtrace End ********************

Several points:

  • This is not valid json despite my request
  • This is not quiet, despite my request 😄

I'm not sure the best solution to this, but it does seem that this could be improved by either:

  • Not sending this output when --quiet is passed
  • Reformatting it as json if --json is passed

mamba info / micromamba info

libmamba version : 2.0.5
     micromamba version : 2.0.5
           curl version : libcurl/8.11.1 OpenSSL/3.4.0 zlib/1.3.1 zstd/1.5.6 libssh2/1.11.1 nghttp2/1.64.0
     libarchive version : libarchive 3.7.7 zlib/1.3.1 bz2lib/1.0.8 libzstd/1.5.6
       envs directories : /root/micromamba/envs
          package cache : /root/micromamba/pkgs
                          /root/.mamba/pkgs
            environment : foo (active)
           env location : /root/micromamba/envs/foo
      user config files : /root/.mambarc
 populated config files : /etc/conda/.mambarc
       virtual packages : __unix=0=0
                          __linux=6.6.51=0
                          __glibc=2.17=0
                          __archspec=1=x86_64_v3
               channels : https://artifactory.esss.lu.se/artifactory/api/conda/conda-e3/linux-64
                          https://artifactory.esss.lu.se/artifactory/api/conda/conda-e3/noarch
                          https://artifactory.esss.lu.se/artifactory/api/conda/ics-conda-forge/linux-64
                          https://artifactory.esss.lu.se/artifactory/api/conda/ics-conda-forge/noarch
                          https://artifactory.esss.lu.se/artifactory/api/conda/conda-forge/linux-64
                          https://artifactory.esss.lu.se/artifactory/api/conda/conda-forge/noarch
       base environment : /root/micromamba
               platform : linux-64

Logs

info     libmamba ****************** Backtrace Start ******************
debug    libmamba Loading configuration
trace    libmamba Compute configurable 'create_base'
trace    libmamba Compute configurable 'no_env'
trace    libmamba Compute configurable 'no_rc'
trace    libmamba Compute configurable 'rc_files'
trace    libmamba Compute configurable 'root_prefix'
trace    libmamba Get RC files configuration from locations up to HomeDir
trace    libmamba Configuration not found at '/root/.mambarc'
trace    libmamba Configuration not found at '/root/.mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.mamba/mambarc'
trace    libmamba Configuration not found at '/root/.mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.condarc'
trace    libmamba Configuration not found at '/root/.conda/condarc.d'
trace    libmamba Configuration not found at '/root/.conda/condarc'
trace    libmamba Configuration not found at '/root/.conda/.condarc'
trace    libmamba Configuration not found at '/root/.config/conda/condarc.d'
trace    libmamba Configuration not found at '/root/.config/conda/condarc'
trace    libmamba Configuration not found at '/root/.config/conda/.condarc'
trace    libmamba Configuration not found at '/root/micromamba/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/condarc'
trace    libmamba Configuration not found at '/root/micromamba/.condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.mambarc'
trace    libmamba Configuration not found at '/var/lib/conda/condarc.d/'
trace    libmamba Configuration not found at '/var/lib/conda/condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.condarc'
trace    libmamba Configuration found at '/etc/conda/.mambarc'
trace    libmamba Configuration not found at '/etc/conda/condarc.d/'
trace    libmamba Configuration not found at '/etc/conda/condarc'
trace    libmamba Configuration not found at '/etc/conda/.condarc'
trace    libmamba Update configurable 'no_env'
trace    libmamba Compute configurable 'envs_dirs'
trace    libmamba Compute configurable 'file_specs'
trace    libmamba Compute configurable 'spec_file_env_name'
trace    libmamba Compute configurable 'env_name'
trace    libmamba Compute configurable 'use_default_prefix_fallback'
trace    libmamba Compute configurable 'use_root_prefix_fallback'
trace    libmamba Compute configurable 'use_target_prefix_fallback'
trace    libmamba Compute configurable 'target_prefix'
trace    libmamba Get RC files configuration from locations up to TargetPrefix
trace    libmamba Configuration not found at '/root/micromamba/envs/food/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/condarc'
trace    libmamba Configuration not found at '/root/micromamba/envs/food/.condarc'
trace    libmamba Configuration not found at '/root/.mambarc'
trace    libmamba Configuration not found at '/root/.mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.mamba/mambarc'
trace    libmamba Configuration not found at '/root/.mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc.d'
trace    libmamba Configuration not found at '/root/.config/mamba/mambarc'
trace    libmamba Configuration not found at '/root/.config/mamba/.mambarc'
trace    libmamba Configuration not found at '/root/.condarc'
trace    libmamba Configuration not found at '/root/.conda/condarc.d'
trace    libmamba Configuration not found at '/root/.conda/condarc'
trace    libmamba Configuration not found at '/root/.conda/.condarc'
trace    libmamba Configuration not found at '/root/.config/conda/condarc.d'
trace    libmamba Configuration not found at '/root/.config/conda/condarc'
trace    libmamba Configuration not found at '/root/.config/conda/.condarc'
trace    libmamba Configuration not found at '/root/micromamba/.mambarc'
trace    libmamba Configuration not found at '/root/micromamba/condarc.d'
trace    libmamba Configuration not found at '/root/micromamba/condarc'
trace    libmamba Configuration not found at '/root/micromamba/.condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.mambarc'
trace    libmamba Configuration not found at '/var/lib/conda/condarc.d/'
trace    libmamba Configuration not found at '/var/lib/conda/condarc'
trace    libmamba Configuration not found at '/var/lib/conda/.condarc'
trace    libmamba Configuration found at '/etc/conda/.mambarc'
trace    libmamba Configuration not found at '/etc/conda/condarc.d/'
trace    libmamba Configuration not found at '/etc/conda/condarc'
trace    libmamba Configuration not found at '/etc/conda/.condarc'
trace    libmamba Update configurable 'no_env'
trace    libmamba Compute configurable 'relocate_prefix'
trace    libmamba Compute configurable 'target_prefix_checks'
error    libmamba No prefix found at: /root/micromamba/envs/food
error    libmamba Environment must first be created with "micromamba create -n {env_name} ..."
critical libmamba Aborting.
info     libmamba ****************** Backtrace End ********************

environment.yml

~/.condarc

@simon-ess
Copy link
Author

I realise now that I had mis-read the output of this command and the error log is in stderr, not stdout as I originally thought. The only "bug" here admittedly is that the --json parameter is sort of incorrect, since it returns an empty string which is not valid json.

@Hind-M
Copy link
Member

Hind-M commented Jan 23, 2025

Well since the command is supposed to error out, it's aborting right in the middle leading to not constructing a valid json to be returned. So the behavior seems legit.

@Hind-M Hind-M added the type::question Further information is requested label Jan 23, 2025
@simon-ess
Copy link
Author

I think that if you request json output, even an error should give json output (if empty!); I suspect that most of the time this is going to be used because another program is expected to parse the output, and that program will now have to deal with an exceptional case instead of just ending up with empty, but valid output.

@Hind-M Hind-M added type::bug Something isn't working --json Problems with --json and removed type::question Further information is requested labels Jan 27, 2025
@Hind-M
Copy link
Member

Hind-M commented Jan 27, 2025

Should be considered when tackling #2288.

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

No branches or pull requests

2 participants