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 self-update unnecessarily errors with libmamba Could not lock non-existing path '/Users/home/micromamba/conda-meta' #3734

Closed
3 tasks done
corneliusroemer opened this issue Jan 8, 2025 · 7 comments
Labels
status::cannot-reproduce The bug could not be reproduced type::bug Something isn't working

Comments

@corneliusroemer
Copy link
Contributor

corneliusroemer commented Jan 8, 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

self-update

Latest version of Mamba

  • My problem is not solved with the latest version [one can't possibly self-update on the latest version ;) ]

Tried in Conda?

I didn't try

Describe your issue

When doing micromamba self-update (on version 2.0.2) I get an error, even though the update succeeds. So a false-positive error. The update code seems to assume something that isn't true in my case:

$ micromamba self-update
conda-forge/osx-arm64                               13.8MB @  27.1MB/s  0.4s
conda-forge/noarch                                  18.4MB @  24.6MB/s  0.7s

  Installing micromamba version: 2.0.5 (currently installed 2.0.2)
  Fetching micromamba from https://conda.anaconda.org/conda-forge/osx-arm64/micromamba-2.0.5-0.tar.bz2

error    libmamba Could not lock non-existing path '/Users/corneliusromer/micromamba/conda-meta'

Transaction starting
micromamba                                           6.1MB @   8.1MB/s  0.5s
Download only - packages are downloaded and extracted. Skipping the linking phase.

Actually, the update seems to have worked, despite the error. I only just found out while filing the issue. It's still a bug :)

mamba info / micromamba info

libmamba version : 2.0.5
     micromamba version : 2.0.5
           curl version : libcurl/8.11.1 (OpenSSL/3.4.0) SecureTransport 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 : /Users/corneliusromer/micromamba/envs
          package cache : /Users/corneliusromer/micromamba/pkgs
                          /Users/corneliusromer/.mamba/pkgs
            environment : py13 (active)
           env location : /Users/corneliusromer/micromamba/envs/py13
      user config files : /Users/corneliusromer/.mambarc
 populated config files : /Users/corneliusromer/.mambarc
                          /Users/corneliusromer/.condarc
       virtual packages : __unix=0=0
                          __osx=15.2=0
                          __archspec=1=arm64
               channels : https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/bioconda/noarch
                          https://conda.anaconda.org/bioconda/osx-arm64
                          https://conda.anaconda.org/nodefaults/noarch
                          https://conda.anaconda.org/nodefaults/osx-arm64
       base environment : /Users/corneliusromer/micromamba
               platform : osx-arm64

Logs

micromamba self-update
conda-forge/osx-arm64                               13.8MB @  27.1MB/s  0.4s
conda-forge/noarch                                  18.4MB @  24.6MB/s  0.7s

  Installing micromamba version: 2.0.5 (currently installed 2.0.2)
  Fetching micromamba from https://conda.anaconda.org/conda-forge/osx-arm64/micromamba-2.0.5-0.tar.bz2

error    libmamba Could not lock non-existing path '/Users/corneliusromer/micromamba/conda-meta'

Transaction starting
micromamba                                           6.1MB @   8.1MB/s  0.5s
Download only - packages are downloaded and extracted. Skipping the linking phase.

~/Desktop/ExportedEmails via 🐍 v3.13.1 via 🅒 py13 on ☁️  (us-east-1) in ☸ aws (production) took 6s
❯ micromamba info

       libmamba version : 2.0.5
     micromamba version : 2.0.5
           curl version : libcurl/8.11.1 (OpenSSL/3.4.0) SecureTransport 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 : /Users/corneliusromer/micromamba/envs
          package cache : /Users/corneliusromer/micromamba/pkgs
                          /Users/corneliusromer/.mamba/pkgs
            environment : py13 (active)
           env location : /Users/corneliusromer/micromamba/envs/py13
      user config files : /Users/corneliusromer/.mambarc
 populated config files : /Users/corneliusromer/.mambarc
                          /Users/corneliusromer/.condarc
       virtual packages : __unix=0=0
                          __osx=15.2=0
                          __archspec=1=arm64
               channels : https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/bioconda/noarch
                          https://conda.anaconda.org/bioconda/osx-arm64
                          https://conda.anaconda.org/nodefaults/noarch
                          https://conda.anaconda.org/nodefaults/osx-arm64
       base environment : /Users/corneliusromer/micromamba
               platform : osx-arm64

~/Desktop/ExportedEmails via 🐍 v3.13.1 via 🅒 py13 on ☁️  (us-east-1) in ☸ aws (production)
❯ micromamba
Version: 2.0.5

Usage: /Users/corneliusromer/.local/bin/micromamba [OPTIONS] [SUBCOMMAND]

Options:
  -h,--help                   Print this help message and exit
  --version


Configuration options:
  --rc-file TEXT ...          Paths to the configuration files to use
  --no-rc                     Disable the use of configuration files
  --no-env                    Disable the use of environment variables


Global options:
  -v,--verbose                Set verbosity (higher verbosity with multiple -v, e.g. -vvv)
  --log-level ENUM:value in {critical->5,debug->1,error->4,info->2,off->6,trace->0,warning->3} OR {5,1,4,2,6,0,3}
                              Set the log level
  -q,--quiet                  Set quiet mode (print less output)
  -y,--yes                    Automatically answer yes on prompted questions
  --json                      Report all output as json
  --offline                   Force use cached repodata
  --dry-run                   Only display what would have been done
  --download-only             Only download and extract packages, do not link them into environment.
  --experimental              Enable experimental features


Prefix options:
  -r,--root-prefix TEXT       Path to the root prefix
  -p,--prefix TEXT            Path to the target prefix
  --relocate-prefix TEXT      Path to the relocation prefix
  -n,--name TEXT              Name of the target prefix

Subcommands:
  shell                       Generate shell init scripts
  create                      Create new environment
  install                     Install packages in active environment
  update                      Update packages in active environment
  self-update                 Update micromamba
  repoquery                   Find and analyze packages in active environment or channels
  remove, uninstall           Remove packages from active environment
  list                        List packages in active environment
  package                     Extract a package or bundle files into an archive
  clean                       Clean package cache
  config                      Configuration of micromamba
  info                        Information about micromamba
  constructor                 Commands to support using micromamba in constructor
  env                         See `mamba/micromamba env --help`
  activate                    Activate an environment
  run                         Run an executable in an environment
  ps                          Show, inspect or kill running processes
  auth                        Login or logout of a given host
  search                      Find packages in active environment or channels
                              This is equivalent to `repoquery search` command

~/.condarc

always_yes: true
show_channel_urls: true
solver: libmamba
changeps1: False
channels:
  - bioconda
  - conda-forge
  - nodefaults
channel_priority: strict

~/.mambarc

repodata_use_zst: true
channels:
- conda-forge
- bioconda
@corneliusroemer corneliusroemer changed the title micromamba self-update errors with libmamba Could not lock non-existing path '/Users/home/micromamba/conda-meta' micromamba self-update unnecessarily errors with libmamba Could not lock non-existing path '/Users/home/micromamba/conda-meta' Jan 8, 2025
@jjerphan jjerphan added the status::cannot-reproduce The bug could not be reproduced label Jan 8, 2025
@corneliusroemer
Copy link
Contributor Author

@jjerphan Agree reproducibility is gonna be hard here, so the general lesson is maybe to provide a few more details for errors in such cases, so one can try to find out what happened nonetheless, e.g. a stacktrace.

@jjerphan jjerphan added the type::bug Something isn't working label Jan 8, 2025
@corneliusroemer
Copy link
Contributor Author

corneliusroemer commented Jan 8, 2025

I had a look at the micromamba self-update command and found something that looks relevant:

update_self(Configuration& config, const std::optional<std::string>& version)
{
auto& ctx = config.context();
config.load();
// set target_prefix to root_prefix (irrelevant, but transaction tries to lock
// the conda-meta folder of the target_prefix)
ctx.prefix_params.target_prefix = ctx.prefix_params.root_prefix;

The comment suggests this is a bit of a hack/shim to allow micromamba self-update to reuse existing functionality that requires a root prefix (micromamba doesn't but the mamba does).

So it looks like this is a reproducible bug: if the dir is not there, the error happens (I'll try to repro later).

An easy hack/fix would be to create that directory if not present.

Something like:

    // Ensure conda-meta folder exists
    fs::u8path conda_meta_path = ctx.prefix_params.target_prefix / "conda-meta";
    if (!fs::exists(conda_meta_path))
    {
        fs::create_directories(conda_meta_path);
    }

@jjerphan
Copy link
Member

jjerphan commented Jan 8, 2025

Yes, thank you for the suggestion. We can add a text field in .github/ISSUE_TEMPLATE/bug.yml so that users can give stacktrace.

@corneliusroemer
Copy link
Contributor Author

corneliusroemer commented Jan 8, 2025

Yes, thank you for the suggestion. We can add a text field in .github/ISSUE_TEMPLATE/bug.yml so that users can give stacktrace.

Ah we're at cross-purposes, sorry I wasn't clear. I meant that the error message could be more informative - this is an unhandled error, it shouldn't really happen. What wew do in Nextstrain ecosystem is to print a stacktrace and suggest that users open an issue with it so that unhandled errors can be handled appropriately.

One could insert a backtrace here:

if (ec)
{
std::cerr << "error: " << ec.message() << std::endl;
}

    void* array[10];
    size_t size;

    // Get the stack trace
    size = backtrace(array, 10);

    // Print the stack trace to stderr
    backtrace_symbols_fd(array, size, STDERR_FILENO);

@corneliusroemer
Copy link
Contributor Author

Good news, I couldn't reproduce this on stock ubuntu docker image like this:

docker run -it --rm ubuntu:22.04 bash

then inside this all works as expected:

apt-get update && apt-get install -y \
    curl \
    ca-certificates \
    tar \
    xz-utils \
    bzip2 \
    file \
    zsh \
    && apt-get clean

export VERSION=2.0.2-0

bash -c "$(curl -L micro.mamba.pm/install.sh)"

source ~/.bashrc

micromamba --version

micromamba self-update

micromambaa --version

So it must be something weird with my zshrc setup or mac specific.

@jjerphan
Copy link
Member

So it must be something weird with my zshrc setup or mac specific.

Yes, from memory you have had several installation and shell initialization, so you better see whether this error is due to your setup before open issues.

I opened #3752 anyway.

@jjerphan
Copy link
Member

This should have been fixed by #3572, see #3752 (review) for context.

Feel free to reopen if you still have the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status::cannot-reproduce The bug could not be reproduced type::bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants