mamba-org / mamba

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

Micromamba appears to fail at unlinking on Anaconda3 Docker #2193

Open mfansler opened 1 year ago

mfansler commented 1 year ago

Not sure where to report this, but here's some curious behavior: Attempting to use Micromamba to install mamba into the Anaconda installation in the official Docker image (continuumio/anaconda3) results in warnings and critical errors from libmamba. These seem to indicate cryptic failures in unlinking existing packages.

I was hoping to give users a recommendation for how to quickly install Mamba into Anaconda base by using Micromamba, but this is worrisome behavior. Please let me know if something more needs to be configured besides the MAMBA_ROOT_PREFIX.

Reproducible Results

$ docker run -it --rm continuumio/anaconda3:2022.10 /bin/bash
(base) root@1d86990aebce:/# curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
(base) root@1d86990aebce:/# export MAMBA_ROOT_PREFIX=$(conda config --show root_prefix | cut -d' ' -f2)
(base) root@1d86990aebce:/# micromamba install -yn base -c conda-forge 'mamba>=1'

                                           __
          __  ______ ___  ____ _____ ___  / /_  ____ _
         / / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
        / /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
       / .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
      /_/

conda-forge/noarch                                  10.7MB @   4.1MB/s  2.7s
conda-forge/linux-64                                28.7MB @   3.9MB/s  7.8s

Pinned packages:
  - python 3.9.*

Transaction

  Prefix: /opt/conda

  Updating specs:

   - mamba[version='>=1']

  Package                      Version  Build               Channel                   Size
────────────────────────────────────────────────────────────────────────────────────────────
  Install:
────────────────────────────────────────────────────────────────────────────────────────────

  + alsa-lib                     1.2.8  h166bdaf_0          conda-forge/linux-64     592kB
  + attr                         2.5.1  h166bdaf_1          conda-forge/linux-64      71kB
  + fmt                          9.1.0  h924138e_0          conda-forge/linux-64     190kB
  + font-ttf-dejavu-sans-mono     2.37  hab24e00_0          conda-forge/noarch       397kB
  + font-ttf-inconsolata         3.000  h77eed37_0          conda-forge/noarch        97kB
  + font-ttf-source-code-pro     2.038  h77eed37_0          conda-forge/noarch       701kB
  + font-ttf-ubuntu               0.83  hab24e00_0          conda-forge/noarch         2MB
  + fonts-conda-ecosystem            1  0                   conda-forge/noarch         4kB
  + fonts-conda-forge                1  0                   conda-forge/noarch         4kB
  + gettext                     0.21.1  h27087fc_0          conda-forge/linux-64       4MB
  + glib-tools                  2.74.1  h6239696_1          conda-forge/linux-64     109kB
  + gstreamer-orc               0.4.33  h166bdaf_0          conda-forge/linux-64     306kB
  + jack                        1.9.21  h583fa2b_2          conda-forge/linux-64     461kB
  + keyutils                     1.6.1  h166bdaf_0          conda-forge/linux-64     118kB
  + lame                         3.100  h166bdaf_1003       conda-forge/linux-64     508kB
  + libcap                        2.66  ha37c62d_0          conda-forge/linux-64     100kB
  + libclang13                  15.0.6  default_h3a83d3e_0  conda-forge/linux-64       9MB
  + libcups                      2.3.3  h36d4200_3          conda-forge/linux-64       5MB
  + libdb                       6.2.32  h9c3ff4c_0          conda-forge/linux-64      24MB
  + libflac                      1.4.2  h27087fc_0          conda-forge/linux-64     421kB
  + libgcrypt                   1.10.1  h166bdaf_0          conda-forge/linux-64     720kB
  + libglib                     2.74.1  h606061b_1          conda-forge/linux-64       3MB
  + libgpg-error                  1.45  hc0c96e0_0          conda-forge/linux-64     292kB
  + libiconv                      1.17  h166bdaf_0          conda-forge/linux-64       1MB
  + libllvm15                   15.0.6  h63197d8_0          conda-forge/linux-64      32MB
  + libmamba                     1.1.0  h83d9b23_3          conda-forge/linux-64       1MB
  + libmambapy                   1.1.0  py39hf403a7a_3      conda-forge/linux-64     309kB
  + libnsl                       2.0.0  h7f98852_0          conda-forge/linux-64      31kB
  + libogg                       1.3.4  h7f98852_1          conda-forge/linux-64     211kB
  + libopus                      1.3.1  h7f98852_1          conda-forge/linux-64     261kB
  + libsndfile                   1.1.0  hcb278e6_1          conda-forge/linux-64     349kB
  + libsolv                     0.7.23  h3eb15da_0          conda-forge/linux-64     462kB
  + libsqlite                   3.40.0  h753d276_0          conda-forge/linux-64     810kB
  + libsystemd0                    252  h2a991cd_0          conda-forge/linux-64     393kB
  + libtool                      2.4.6  h9c3ff4c_1008       conda-forge/linux-64     523kB
  + libudev1                       252  h166bdaf_0          conda-forge/linux-64     121kB
  + libvorbis                    1.3.7  h9c3ff4c_0          conda-forge/linux-64     286kB
  + libzlib                     1.2.13  h166bdaf_4          conda-forge/linux-64      66kB
  + mamba                        1.1.0  py39hfa8f2c8_3      conda-forge/linux-64      50kB
  + mpg123                      1.31.1  h27087fc_0          conda-forge/linux-64     535kB
  + mysql-common                8.0.31  haf5c9bc_0          conda-forge/linux-64       2MB
  + mysql-libs                  8.0.31  h28c427c_0          conda-forge/linux-64       2MB
  + pcre2                        10.40  hc3806b6_0          conda-forge/linux-64       2MB
  + pthread-stubs                  0.4  h36c2ea0_1001       conda-forge/linux-64       6kB
  + pulseaudio                    16.1  h4a94279_0          conda-forge/linux-64       2MB
  + pybind11-abi                     4  hd8ed1ab_3          conda-forge/noarch        10kB
  + python_abi                     3.9  3_cp39              conda-forge/linux-64       6kB
  + reproc                      14.2.4  h0b41bf4_0          conda-forge/linux-64      30kB
  + reproc-cpp                  14.2.4  hcb278e6_0          conda-forge/linux-64      22kB
  + xcb-util                     0.4.0  h516909a_0          conda-forge/linux-64      20kB
  + xcb-util-image               0.4.0  h166bdaf_0          conda-forge/linux-64      24kB
  + xcb-util-keysyms             0.4.0  h516909a_0          conda-forge/linux-64      12kB
  + xcb-util-renderutil          0.3.9  h166bdaf_0          conda-forge/linux-64      16kB
  + xcb-util-wm                  0.4.1  h516909a_0          conda-forge/linux-64      56kB
  + xorg-libxau                  1.0.9  h7f98852_0          conda-forge/linux-64      13kB
  + xorg-libxdmcp                1.1.3  h7f98852_0          conda-forge/linux-64      19kB
  + yaml-cpp                     0.7.0  h27087fc_2          conda-forge/linux-64     220kB

  Remove:
────────────────────────────────────────────────────────────────────────────────────────────

  - anaconda                   2022.10  py39_0              pkgs/main                 16kB
  - qt                          5.15.9  h06a4308_0          pkgs/main                  9kB

  Change:
────────────────────────────────────────────────────────────────────────────────────────────

  - _libgcc_mutex                  0.1  main                pkgs/main                  3kB
  + _libgcc_mutex                  0.1  conda_forge         conda-forge/linux-64       3kB
  - pyqt                        5.15.7  py39h6a678d5_1      pkgs/main                  5MB
  + pyqt                        5.15.7  py39h18e9c17_2      conda-forge/linux-64       6MB
  - pyqt5-sip                  12.11.0  py39h6a678d5_1      pkgs/main                 89kB
  + pyqt5-sip                  12.11.0  py39h5a03fae_2      conda-forge/linux-64      88kB
  - pyqtwebengine               5.15.7  py39h6a678d5_1      pkgs/main                163kB
  + pyqtwebengine               5.15.7  py39h18e9c17_2      conda-forge/linux-64     178kB
  - qtwebkit                     5.212  h4eab89a_4          pkgs/main                 15MB
  + qtwebkit                     5.212  h3383a02_6          conda-forge/linux-64      18MB

  Upgrade:
────────────────────────────────────────────────────────────────────────────────────────────

  - curl                        7.84.0  h5eee18b_0          pkgs/main                 81kB
  + curl                        7.87.0  h6312ad2_0          conda-forge/linux-64      88kB
  - expat                        2.4.9  h6a678d5_0          pkgs/main                160kB
  + expat                        2.5.0  h27087fc_0          conda-forge/linux-64     194kB
  - fftw                         3.3.9  h27cfd23_1          pkgs/main                  2MB
  + fftw                        3.3.10  nompi_hf0379b8_106  conda-forge/linux-64       2MB
  - fontconfig                  2.13.1  h6c09931_0          pkgs/main                256kB
  + fontconfig                  2.14.1  hc2a2eb6_0          conda-forge/linux-64     374kB
  - freetype                    2.11.0  h70c0345_0          pkgs/main                633kB
  + freetype                    2.12.1  hca18f0e_1          conda-forge/linux-64     626kB
  - glib                        2.69.1  h4ff587b_1          pkgs/main                  2MB
  + glib                        2.74.1  h6239696_1          conda-forge/linux-64     486kB
  - gst-plugins-base            1.14.0  h8213a91_2          pkgs/main                  5MB
  + gst-plugins-base            1.21.3  h4243ec0_1          conda-forge/linux-64       3MB
  - gstreamer                   1.14.0  h28cd5cc_2          pkgs/main                  3MB
  + gstreamer                   1.21.3  h25f0c4b_1          conda-forge/linux-64       2MB
  - icu                           58.2  he6710b0_3          pkgs/main                 11MB
  + icu                           70.1  h27087fc_0          conda-forge/linux-64      14MB
  - krb5                        1.19.2  hac12032_0          pkgs/main                  1MB
  + krb5                        1.20.1  hf9c8cef_0          conda-forge/linux-64       1MB
  - libarchive                   3.6.1  hab531cd_0          pkgs/main                834kB
  + libarchive                   3.6.2  hc8874e4_0          conda-forge/linux-64     834kB
  - libclang                    10.0.1  default_hb85057a_2  pkgs/main                 11MB
  + libclang                    15.0.6  default_h2e3cab8_0  conda-forge/linux-64     132kB
  - libcurl                     7.84.0  h91b91d3_0          pkgs/main                346kB
  + libcurl                     7.87.0  h6312ad2_0          conda-forge/linux-64     347kB
  - libffi                         3.3  he6710b0_2          pkgs/main                 52kB
  + libffi                       3.4.2  h7f98852_5          conda-forge/linux-64      58kB
  - libgcc-ng                   11.2.0  h1234567_1          pkgs/main                  6MB
  + libgcc-ng                   12.2.0  h65d4601_19         conda-forge/linux-64     954kB
  - libgomp                     11.2.0  h1234567_1          pkgs/main                485kB
  + libgomp                     12.2.0  h65d4601_19         conda-forge/linux-64     466kB
  - libnghttp2                  1.46.0  hce63b2e_0          pkgs/main                696kB
  + libnghttp2                  1.47.0  hdcd2b5c_1          conda-forge/linux-64     828kB
  - libpng                      1.6.37  hbc83047_0          pkgs/main                285kB
  + libpng                      1.6.39  h753d276_0          conda-forge/linux-64     283kB
  - libpq                         12.9  h16c4e8d_3          pkgs/main                  2MB
  + libpq                         15.1  h2baec63_2          conda-forge/linux-64       2MB
  - libstdcxx-ng                11.2.0  h1234567_1          pkgs/main                  5MB
  + libstdcxx-ng                12.2.0  h46fd767_19         conda-forge/linux-64       4MB
  - libuuid                      1.0.3  h7f8727e_2          pkgs/main                 17kB
  + libuuid                     2.32.1  h7f98852_1000       conda-forge/linux-64      28kB
  - libwebp                      1.2.2  h55f646e_0          pkgs/main                 82kB
  + libwebp                      1.2.4  h522a892_0          conda-forge/linux-64      90kB
  - libwebp-base                 1.2.2  h7f8727e_0          pkgs/main                451kB
  + libwebp-base                 1.2.4  h166bdaf_0          conda-forge/linux-64     413kB
  - libxkbcommon                 1.0.1  hfa300c1_0          pkgs/main                495kB
  + libxkbcommon                 1.0.3  he3ba5ed_0          conda-forge/linux-64     595kB
  - libxml2                     2.9.14  h74e7548_0          pkgs/main                735kB
  + libxml2                     2.10.3  h7463322_0          conda-forge/linux-64     773kB
  - libxslt                     1.1.35  h4e12654_0          pkgs/main                463kB
  + libxslt                     1.1.37  h873f0b0_0          conda-forge/linux-64     258kB
  - lxml                         4.9.1  py39h1edc446_0      pkgs/main                  1MB
  + lxml                         4.9.2  py39h14694de_0      conda-forge/linux-64       1MB
  - nspr                          4.33  h295c915_0          pkgs/main                227kB
  + nspr                          4.35  h27087fc_0          conda-forge/linux-64     227kB
  - nss                           3.74  h0370c37_0          pkgs/main                  2MB
  + nss                           3.82  he02c5a1_0          conda-forge/linux-64       2MB
  - openssl                     1.1.1q  h7f8727e_0          pkgs/main                  3MB
  + openssl                     1.1.1s  h0b41bf4_1          conda-forge/linux-64       2MB
  - python                      3.9.13  haa1d7c7_1          pkgs/main                 22MB
  + python                      3.9.15  h47a2c10_0_cpython  conda-forge/linux-64      22MB
  - qt-main                     5.15.2  h327a75a_7          pkgs/main                 47MB
  + qt-main                     5.15.6  h62441b5_5          conda-forge/linux-64      55MB
  - sip                          6.6.2  py39h6a678d5_0      pkgs/main                434kB
  + sip                          6.7.5  py39h5a03fae_0      conda-forge/linux-64     475kB
  - zlib                        1.2.12  h5eee18b_3          pkgs/main                106kB
  + zlib                        1.2.13  h166bdaf_4          conda-forge/linux-64      94kB

  Downgrade:
────────────────────────────────────────────────────────────────────────────────────────────

  - _openmp_mutex                  5.1  1_gnu               pkgs/main                 21kB
  + _openmp_mutex                  4.5  2_gnu               conda-forge/linux-64      24kB
  - libevent                    2.1.12  h8f2d780_0          pkgs/main                435kB
  + libevent                    2.1.10  h9b69904_4          conda-forge/linux-64       1MB
  - libxcb                        1.15  h7f8727e_0          pkgs/main                518kB
  + libxcb                        1.13  h7f98852_1004       conda-forge/linux-64     400kB
  - qt-webengine                5.15.9  hd2b0992_4          pkgs/main                 49MB
  + qt-webengine                5.15.4  h325cec9_3          conda-forge/linux-64      52MB

  Summary:

  Install: 57 packages
  Remove: 2 packages
  Change: 5 packages
  Upgrade: 34 packages
  Downgrade: 4 packages

  Total download: 299MB

────────────────────────────────────────────────────────────────────────────────────────────

Transaction starting
[ download timings omitted ]

Unlinking anaconda-2022.10-py39_0
Linking font-ttf-dejavu-sans-mono-2.37-hab24e00_0
Linking font-ttf-ubuntu-0.83-hab24e00_0
Linking font-ttf-inconsolata-3.000-h77eed37_0
Linking font-ttf-source-code-pro-2.038-h77eed37_0
Linking pybind11-abi-4-hd8ed1ab_3
Linking fonts-conda-forge-1-0
Linking fonts-conda-ecosystem-1-0
Linking python_abi-3.9-3_cp39
Changing libstdcxx-ng-11.2.0-h1234567_1 ==> libstdcxx-ng-12.2.0-h46fd767_19
warning  libmamba [libstdcxx-ng-12.2.0-h46fd767_19] The following files were already present in the environment:
    - lib/libstdc++.so
    - lib/libstdc++.so.6
    - share/licenses/libstdc++/RUNTIME.LIBRARY.EXCEPTION
Changing _libgcc_mutex-0.1-main ==> _libgcc_mutex-0.1-conda_forge
Changing libgomp-11.2.0-h1234567_1 ==> libgomp-12.2.0-h65d4601_19
warning  libmamba [libgomp-12.2.0-h65d4601_19] The following files were already present in the environment:
    - lib/libgomp.so
    - lib/libgomp.so.1.0.0
    - share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION.gomp_copy
Changing _openmp_mutex-5.1-1_gnu ==> _openmp_mutex-4.5-2_gnu
warning  libmamba [_openmp_mutex-4.5-2_gnu] The following files were already present in the environment:
    - lib/libgomp.so.1
Changing libgcc-ng-11.2.0-h1234567_1 ==> libgcc-ng-12.2.0-h65d4601_19
warning  libmamba [libgcc-ng-12.2.0-h65d4601_19] The following files were already present in the environment:
    - lib/libatomic.so
    - lib/libatomic.so.1
    - lib/libatomic.so.1.2.0
    - lib/libgcc_s.so
    - lib/libgcc_s.so.1
    - lib/libitm.so
    - lib/libitm.so.1
    - lib/libitm.so.1.0.0
    - lib/libquadmath.so
    - lib/libquadmath.so.0
    - lib/libquadmath.so.0.0.0
    - share/info/libgomp.info
    - share/info/libquadmath.info
    - share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION
Linking xorg-libxdmcp-1.1.3-h7f98852_0
Linking xorg-libxau-1.0.9-h7f98852_0
Linking pthread-stubs-0.4-h36c2ea0_1001
Linking libdb-6.2.32-h9c3ff4c_0
Linking lame-3.100-h166bdaf_1003
Linking attr-2.5.1-h166bdaf_1
Linking libogg-1.3.4-h7f98852_1
Linking libudev1-252-h166bdaf_0
Linking libtool-2.4.6-h9c3ff4c_1008
Linking mpg123-1.31.1-h27087fc_0
Linking gstreamer-orc-0.4.33-h166bdaf_0
Linking libopus-1.3.1-h7f98852_1
Linking reproc-14.2.4-h0b41bf4_0
Linking yaml-cpp-0.7.0-h27087fc_2
Linking libnsl-2.0.0-h7f98852_0
Changing openssl-1.1.1q-h7f8727e_0 ==> openssl-1.1.1s-h0b41bf4_1
critical libmamba filesystem error: cannot copy symlink: File exists [/opt/conda/pkgs/openssl-1.1.1s-h0b41bf4_1/lib/libcrypto.so] [/opt/conda/lib/libcrypto.so]

Additional Notes

This only appears to impact Micromamba when operating on the base.

Non-base works fine

Mimicking the same transaction in a new environment does not lead to an issue:

$ docker run -it --rm continuumio/anaconda3:2022.10 /bin/bash
(base) root@1d86990aebce:/# curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
(base) root@1d86990aebce:/# export MAMBA_ROOT_PREFIX=$(conda config --show root_prefix | cut -d' ' -f2)
(base) root@17495a6f9945:/# conda create -yn foo --file <(conda list --export '^openssl$')
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 22.9.0
  latest version: 22.11.1

Please update conda by running

    $ conda update -n base -c defaults conda

## Package Plan ##

  environment location: /opt/conda/envs/foo

  added / updated specs:
    - openssl==1.1.1q=h7f8727e_0

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |             main           3 KB
    _openmp_mutex-5.1          |            1_gnu          21 KB
    ca-certificates-2022.10.11 |       h06a4308_0         124 KB
    libgcc-ng-11.2.0           |       h1234567_1         5.3 MB
    libgomp-11.2.0             |       h1234567_1         474 KB
    openssl-1.1.1q             |       h7f8727e_0         2.5 MB
    ------------------------------------------------------------
                                           Total:         8.5 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main None
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu None
  ca-certificates    pkgs/main/linux-64::ca-certificates-2022.10.11-h06a4308_0 None
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1 None
  libgomp            pkgs/main/linux-64::libgomp-11.2.0-h1234567_1 None
  openssl            pkgs/main/linux-64::openssl-1.1.1q-h7f8727e_0 None

Downloading and Extracting Packages
libgcc-ng-11.2.0     | 5.3 MB    | ############################################################################################################################################################################################ | 100% 
libgomp-11.2.0       | 474 KB    | ############################################################################################################################################################################################ | 100% 
_openmp_mutex-5.1    | 21 KB     | ############################################################################################################################################################################################ | 100% 
ca-certificates-2022 | 124 KB    | ############################################################################################################################################################################################ | 100% 
openssl-1.1.1q       | 2.5 MB    | ############################################################################################################################################################################################ | 100% 
_libgcc_mutex-0.1    | 3 KB      | ############################################################################################################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate foo
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Retrieving notices: ...working... done
(base) root@17495a6f9945:/# micromamba install -yn foo -c conda-forge openssl=1.1.1s=h0b41bf4_1

                                           __
          __  ______ ___  ____ _____ ___  / /_  ____ _
         / / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
        / /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
       / .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
      /_/

conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache

Transaction

  Prefix: /opt/conda/envs/foo

  Updating specs:

   - openssl==1.1.1s=h0b41bf4_1

  Package          Version  Build        Channel                    Size
──────────────────────────────────────────────────────────────────────────
  Change:
──────────────────────────────────────────────────────────────────────────

  - _libgcc_mutex      0.1  main         pkgs/main                Cached
  + _libgcc_mutex      0.1  conda_forge  conda-forge/linux-64        3kB

  Upgrade:
──────────────────────────────────────────────────────────────────────────

  - libgcc-ng       11.2.0  h1234567_1   pkgs/main                Cached
  + libgcc-ng       12.2.0  h65d4601_19  conda-forge/linux-64      954kB
  - libgomp         11.2.0  h1234567_1   pkgs/main                Cached
  + libgomp         12.2.0  h65d4601_19  conda-forge/linux-64      466kB
  - openssl         1.1.1q  h7f8727e_0   pkgs/main                Cached
  + openssl         1.1.1s  h0b41bf4_1   conda-forge/linux-64        2MB

  Downgrade:
──────────────────────────────────────────────────────────────────────────

  - _openmp_mutex      5.1  1_gnu        pkgs/main                Cached
  + _openmp_mutex      4.5  2_gnu        conda-forge/linux-64       24kB

  Summary:

  Change: 1 packages
  Upgrade: 3 packages
  Downgrade: 1 packages

  Total download: 3MB

──────────────────────────────────────────────────────────────────────────

Transaction starting
_openmp_mutex                                       23.6kB @ 111.0kB/s  0.2s
_libgcc_mutex                                        2.6kB @  11.8kB/s  0.2s
libgomp                                            466.2kB @   1.7MB/s  0.3s
libgcc-ng                                          953.8kB @   3.1MB/s  0.3s
openssl                                              2.0MB @   5.6MB/s  0.4s
Changing _libgcc_mutex-0.1-main ==> _libgcc_mutex-0.1-conda_forge
Changing libgomp-11.2.0-h1234567_1 ==> libgomp-12.2.0-h65d4601_19
Changing _openmp_mutex-5.1-1_gnu ==> _openmp_mutex-4.5-2_gnu
Changing libgcc-ng-11.2.0-h1234567_1 ==> libgcc-ng-12.2.0-h65d4601_19
Changing openssl-1.1.1q-h7f8727e_0 ==> openssl-1.1.1s-h0b41bf4_1
Transaction finished
jonashaag commented 1 year ago

Lots of packages from Anaconda channels are being replaced with conda-forge ones in your command. That could cause problems.

mfansler commented 1 year ago

@jonashaag I've thought about channel switching, but I can't get that to stick. Maybe you can elaborate if I missed something.

I'm aware that mixing channels can lead to runtime issues, such as missing symbol references, but that's not the problem here, rather the transactions are warning/failing during file copying/link creation. Perhaps if the failure was in some pre-link or post-link script.

Another possibility is clobbering, say if one channel's build includes files deployed by a differently-named package in another build. But that's not what fails in the openssl case, rather the UNLINK transaction cryptically fails to remove files, then the LINK dies when it tries to create an already existing softlink.

Moreover, in the follow-up test, the exact same transaction pair that emits a libmamba critical error, namely,

works without any error. So, I don't see anything inherent to the channel switching that can explain the behavior.

I'm more thinking there is something about how the Anaconda base is installed, e.g., the Docker image runs these commands after installation:

find /opt/conda/ -follow -type f -name '*.a' -delete
find /opt/conda/ -follow -type f -name '*.js.map' -delete
/opt/conda/bin/conda clean -afy

Does Micromamba somehow depend on something being deleted there? Does it short-circuit if a single file listed in the conda-meta/*.json manifests isn't there?

jonashaag commented 1 year ago

Maybe you can try to do the package removals only and have a look at the filesystem state after that? Are some files left over? Maybe the json files are incomplete?

jonashaag commented 1 year ago

Another wild guess, maybe Mamba doesn’t correctly handle packages being switched from one channel to another (my idea would be that it doesn’t correctly remove the old package). I guess this could also be checked by doing the uninstalls explicitly and inspecting the filesystem.

mfansler commented 1 year ago

Maybe you can try to do the package removals only and have a look at the filesystem state after that? Are some files left over? Maybe the json files are incomplete?

JSONs appear complete

```bash (base) root@f653a4a3b93e:/# sed -n '/"files":/,/]/p' /opt/conda/conda-meta/openssl-1.1.1q-h7f8727e_0.json "files": [ "bin/c_rehash", "bin/openssl", "include/openssl/aes.h", "include/openssl/asn1.h", "include/openssl/asn1_mac.h", "include/openssl/asn1err.h", "include/openssl/asn1t.h", "include/openssl/async.h", "include/openssl/asyncerr.h", "include/openssl/bio.h", "include/openssl/bioerr.h", "include/openssl/blowfish.h", "include/openssl/bn.h", "include/openssl/bnerr.h", "include/openssl/buffer.h", "include/openssl/buffererr.h", "include/openssl/camellia.h", "include/openssl/cast.h", "include/openssl/cmac.h", "include/openssl/cms.h", "include/openssl/cmserr.h", "include/openssl/comp.h", "include/openssl/comperr.h", "include/openssl/conf.h", "include/openssl/conf_api.h", "include/openssl/conferr.h", "include/openssl/crypto.h", "include/openssl/cryptoerr.h", "include/openssl/ct.h", "include/openssl/cterr.h", "include/openssl/des.h", "include/openssl/dh.h", "include/openssl/dherr.h", "include/openssl/dsa.h", "include/openssl/dsaerr.h", "include/openssl/dtls1.h", "include/openssl/e_os2.h", "include/openssl/ebcdic.h", "include/openssl/ec.h", "include/openssl/ecdh.h", "include/openssl/ecdsa.h", "include/openssl/ecerr.h", "include/openssl/engine.h", "include/openssl/engineerr.h", "include/openssl/err.h", "include/openssl/evp.h", "include/openssl/evperr.h", "include/openssl/hmac.h", "include/openssl/idea.h", "include/openssl/kdf.h", "include/openssl/kdferr.h", "include/openssl/lhash.h", "include/openssl/md2.h", "include/openssl/md4.h", "include/openssl/md5.h", "include/openssl/mdc2.h", "include/openssl/modes.h", "include/openssl/obj_mac.h", "include/openssl/objects.h", "include/openssl/objectserr.h", "include/openssl/ocsp.h", "include/openssl/ocsperr.h", "include/openssl/opensslconf.h", "include/openssl/opensslv.h", "include/openssl/ossl_typ.h", "include/openssl/pem.h", "include/openssl/pem2.h", "include/openssl/pemerr.h", "include/openssl/pkcs12.h", "include/openssl/pkcs12err.h", "include/openssl/pkcs7.h", "include/openssl/pkcs7err.h", "include/openssl/rand.h", "include/openssl/rand_drbg.h", "include/openssl/randerr.h", "include/openssl/rc2.h", "include/openssl/rc4.h", "include/openssl/rc5.h", "include/openssl/ripemd.h", "include/openssl/rsa.h", "include/openssl/rsaerr.h", "include/openssl/safestack.h", "include/openssl/seed.h", "include/openssl/sha.h", "include/openssl/srp.h", "include/openssl/srtp.h", "include/openssl/ssl.h", "include/openssl/ssl2.h", "include/openssl/ssl3.h", "include/openssl/sslerr.h", "include/openssl/stack.h", "include/openssl/store.h", "include/openssl/storeerr.h", "include/openssl/symhacks.h", "include/openssl/tls1.h", "include/openssl/ts.h", "include/openssl/tserr.h", "include/openssl/txt_db.h", "include/openssl/ui.h", "include/openssl/uierr.h", "include/openssl/whrlpool.h", "include/openssl/x509.h", "include/openssl/x509_vfy.h", "include/openssl/x509err.h", "include/openssl/x509v3.h", "include/openssl/x509v3err.h", "lib/engines-1.1/afalg.so", "lib/engines-1.1/capi.so", "lib/engines-1.1/padlock.so", "lib/libcrypto.a", "lib/libcrypto.so", "lib/libcrypto.so.1.1", "lib/libssl.a", "lib/libssl.so", "lib/libssl.so.1.1", "lib/pkgconfig/libcrypto.pc", "lib/pkgconfig/libssl.pc", "lib/pkgconfig/openssl.pc", "ssl/ct_log_list.cnf", "ssl/ct_log_list.cnf.dist", "ssl/misc/CA.pl", "ssl/misc/tsget", "ssl/misc/tsget.pl", "ssl/openssl.cnf", "ssl/openssl.cnf.dist" ], ```

Dry-Run Transaction

Let's try force-removing openssl.

(base) root@f653a4a3b93e:/# micromamba remove --dry-run -fn base --json openssl
{
    "actions": {
        "PREFIX": "/opt/conda",
        "UNLINK": [
            {
                "build": "h7f8727e_0",
                "build_number": 0,
                "build_string": "h7f8727e_0",
                "channel": "pkgs/main",
                "constrains": null,
                "depends": [
                    "ca-certificates",
                    "libgcc-ng >=7.5.0"
                ],
                "fn": "openssl-1.1.1q-h7f8727e_0.conda",
                "license": "",
                "md5": "2ac47797afee2ece8d339c18b095b8d8",
                "name": "openssl",
                "sha256": "49804293b87141523b2606836ece8e2aaa5202983698fd91e7c36bdb8c8a8de5",
                "size": 2649280,
                "subdir": "linux-64",
                "timestamp": 0,
                "track_features": "",
                "url": "https://repo.anaconda.com/pkgs/main/linux-64/openssl-1.1.1q-h7f8727e_0.conda",
                "version": "1.1.1q"
            }
        ]
    },
    "dry_run": true,
    "prefix": "/opt/conda",
    "success": true
}

Package Removal

Here it reports the error in missing the *.a file, but says it will be ignored.

(base) root@f653a4a3b93e:/# micromamba remove -fn base -vv openssl

                                           __
          __  ______ ___  ____ _____ ___  / /_  ____ _
         / / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
        / /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
       / .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
      /_/

debug    libmamba Loading configuration
debug    libmamba 107 configurables computed
info     libmamba Loading single package record: "/opt/conda/conda-meta/mkl_random-1.2.2-py39h51133e4_0.json"
info     libmamba Loading single package record: "/opt/conda/conda-meta/textdistance-4.2.1-pyhd3eb1b0_0.json"
info     libmamba Loading single package record: "/opt/conda/conda-meta/python-fastjsonschema-2.16.2-py39h06a4308_0.json"
[ omitting additional packages ]
info     libmamba Loading single package record: "/opt/conda/conda-meta/openssl-1.1.1q-h7f8727e_0.json"
[ omitting additional packages ]
info     libmamba Loading single package record: "/opt/conda/conda-meta/libev-4.33-h7f8727e_1.json"
info     libmamba Loading single package record: "/opt/conda/conda-meta/zope-1.0-py39h06a4308_1.json"
info     libmamba Loading single package record: "/opt/conda/conda-meta/conda-package-handling-1.9.0-py39h5eee18b_0.json"
info     libmamba Adding package record to repo _ipyw_jlab_nb_ext_conf
info     libmamba Adding package record to repo _libgcc_mutex
info     libmamba Adding package record to repo _openmp_mutex
[ omitting additional packages ]
info     libmamba Adding package record to repo openssl
[ omitting additional packages ]
info     libmamba Adding package record to repo zope.interface
info     libmamba Adding package record to repo zstd
info     libmamba Parsing MatchSpec openssl
info     libmamba Found python in installed packages 3.9.13
Transaction

  Prefix: /opt/conda

  Removing specs:

   - openssl

debug    libmamba Verify cache '/opt/conda/pkgs' for package extracted directory 'openssl-1.1.1q-h7f8727e_0'
debug    libmamba Extracted package cache '/opt/conda/pkgs/openssl-1.1.1q-h7f8727e_0' not found
debug    libmamba 'openssl-1.1.1q-h7f8727e_0' extracted directory cache is invalid
debug    libmamba Verify cache '/opt/conda/pkgs' for package tarball 'openssl-1.1.1q-h7f8727e_0'
debug    libmamba 'openssl-1.1.1q-h7f8727e_0' tarball cache is invalid
  Package    Version  Build       Channel       Size
──────────────────────────────────────────────────────
  Remove:
──────────────────────────────────────────────────────

  - openssl   1.1.1q  h7f8727e_0  pkgs/main      3MB

  Summary:

  Remove: 1 packages

  Total download: 0 B

──────────────────────────────────────────────────────

Confirm changes: [Y/n] y
debug    libmamba Locking directory '/opt/conda/conda-meta'
debug    libmamba Successfully locked
info     libmamba Cleaned 0 .mamba_trash files. 0 remaining.

Transaction starting
info     libmamba All targets to download are cached
Unlinking openssl-1.1.1q-h7f8727e_0
info     libmamba Unlinking package 'openssl-1.1.1q-h7f8727e_0'
debug    libmamba Use metadata found at '/opt/conda/conda-meta/openssl-1.1.1q-h7f8727e_0.json'
debug    libmamba Error when removing file '/opt/conda/lib/libcrypto.a' will be ignored
info     libmamba Waiting for pyc compilation to finish
Transaction finished
info     libmamba Opening history file: "/opt/conda/conda-meta/history"
debug    libmamba Unlocking '/opt/conda/conda-meta'
info     libmamba Freeing transaction.
info     libmamba Freeing pool.

Inspecting Post-Remove Results

Inspecting the filesystem with ls after the above transaction indicates that most files listed in the JSON were not deleted, but some were. Also, the conda-meta/openssl-1.1.1q-h7f8727e_0.json was deleted.

(base) root@f653a4a3b93e:/# cd /opt/conda
(base) root@f653a4a3b93e:/opt/conda# ls bin/{c_rehash,openssl}
ls: cannot access 'bin/c_rehash': No such file or directory
bin/openssl
(base) root@f653a4a3b93e:/opt/conda# ls include/openssl
aes.h       bnerr.h  conf_api.h   dtls1.h      evperr.h  obj_mac.h      pkcs12.h     rsa.h        stack.h     x509.h
asn1.h      buffer.h     conferr.h    e_os2.h      hmac.h    objects.h      pkcs12err.h  rsaerr.h     store.h     x509_vfy.h
asn1_mac.h  buffererr.h  crypto.h     ebcdic.h     idea.h    objectserr.h   pkcs7.h  safestack.h  storeerr.h  x509err.h
asn1err.h   camellia.h   cryptoerr.h  ec.h     kdf.h     ocsp.h     pkcs7err.h   seed.h       symhacks.h  x509v3.h
asn1t.h     cast.h   ct.h         ecdh.h       kdferr.h  ocsperr.h      rand.h   sha.h        tls1.h      x509v3err.h
async.h     cmac.h   cterr.h      ecdsa.h      lhash.h   opensslconf.h  rand_drbg.h  srp.h        ts.h
asyncerr.h  cms.h    des.h        ecerr.h      md2.h     opensslv.h     randerr.h    srtp.h       tserr.h
bio.h       cmserr.h     dh.h         engine.h     md4.h     ossl_typ.h     rc2.h    ssl.h        txt_db.h
bioerr.h    comp.h   dherr.h      engineerr.h  md5.h     pem.h      rc4.h    ssl2.h       ui.h
blowfish.h  comperr.h    dsa.h        err.h    mdc2.h    pem2.h     rc5.h    ssl3.h       uierr.h
bn.h        conf.h   dsaerr.h     evp.h    modes.h   pemerr.h       ripemd.h     sslerr.h     whrlpool.h
(base) root@f653a4a3b93e:/opt/conda# ls lib/engines-1.1/
afalg.so  capi.so  padlock.so
(base) root@f653a4a3b93e:/opt/conda# ls lib/libcrypto*
lib/libcrypto.so
(base) root@f653a4a3b93e:/opt/conda# ls lib/libssl*
lib/libssl.so  lib/libssl.so.1.1  lib/libssl3.so
(base) root@f653a4a3b93e:/opt/conda# ls lib/pkgconfig/{libcrypto,libssl,openssl}.pc
ls: cannot access 'lib/pkgconfig/libcrypto.pc': No such file or directory
ls: cannot access 'lib/pkgconfig/libssl.pc': No such file or directory
ls: cannot access 'lib/pkgconfig/openssl.pc': No such file or directory
(base) root@f653a4a3b93e:/opt/conda# ls ssl
cacert.pem  cert.pem  ct_log_list.cnf  ct_log_list.cnf.dist  misc  openssl.cnf  openssl.cnf.dist
(base) root@f653a4a3b93e:/opt/conda# ls ssl/misc/
CA.pl  tsget  tsget.pl

The fact that some files are deleted seems to imply that libmamba is getting interrupted (possibly by the missing file error), and then fails to resume the deletion task. I.e., this is a bug.

jonashaag commented 1 year ago

Can you please run with another -v (TRACE)? From the code it doesn’t look like it’s possible that inability to remove a file will stop the rest of the unlinking

mfansler commented 1 year ago

Can you please run with another -v (TRACE)? From the code it doesn’t look like it’s possible that inability to remove a file will stop the rest of the unlinking

Yes, seems like it continues to unlink some files. Here's the last part with TRACE-level logging:

debug    libmamba Locking directory '/opt/conda/conda-meta'
trace    libmamba Lockfile created at '/opt/conda/conda-meta/conda-meta.lock'
debug    libmamba Successfully locked
info     libmamba Cleaned 0 .mamba_trash files. 0 remaining.

Transaction starting
info     libmamba All targets to download are cached
Unlinking openssl-1.1.1q-h7f8727e_0
info     libmamba Unlinking package 'openssl-1.1.1q-h7f8727e_0'
debug    libmamba Use metadata found at '/opt/conda/conda-meta/openssl-1.1.1q-h7f8727e_0.json'
trace    libmamba Unlinking '/opt/conda/bin/c_rehash'
trace    libmamba Unlinking '/opt/conda/lib/libcrypto.a'
debug    libmamba Error when removing file '/opt/conda/lib/libcrypto.a' will be ignored
trace    libmamba Unlinking '/opt/conda/lib/libcrypto.so.1.1'
trace    libmamba Unlinking '/opt/conda/lib/pkgconfig/libcrypto.pc'
trace    libmamba Unlinking '/opt/conda/lib/pkgconfig/libssl.pc'
trace    libmamba Unlinking '/opt/conda/lib/pkgconfig/openssl.pc'
info     libmamba Waiting for pyc compilation to finish
Transaction finished
info     libmamba Opening history file: "/opt/conda/conda-meta/history"
debug    libmamba Unlocking '/opt/conda/conda-meta'
trace    libmamba Removing file '/opt/conda/conda-meta/conda-meta.lock'
info     libmamba Freeing transaction.
info     libmamba Freeing pool.

Files versus Paths

Looking at the full openssl-1.1.1q-h7f8727e_0.json file, the pattern we observe is that only files listed under paths_data.paths are deleted. The remaining files are those that are only listed under the files key.

I'll have to check on the specification, but is this something malformed with this JSON shipping from Anaconda? Checking the one installed in my own system's base (conda-forge/osx-64::openssl-3.0.7-hfd90126_1.json), it appears to have a paths_data.paths entry for every object.

jonashaag commented 1 year ago

Maybe this is a recent extension to the file format that we don’t implement yet

mfansler commented 1 year ago

Just another note that I've also tested the Miniconda3 image (continuumio/miniconda3:22.11.1) and it has similar issues.

In summary, the finding is that Anaconda and Miniconda ship with JSON files in the conda-meta that do not include paths_data.paths entries for every file that is installed. Micromamba apparently depends on this information, but it would be more robust to also check the files list object in the JSON.

The reason why my original "follow-up" test passed was that installing the same package from Anaconda Cloud does result in a full version of the JSON, i.e., includes paths_data.paths entries for all files. In fact, I am unable to find an independent source for a version of the package that has this abridged version of the JSON. Downloading directly from the URL listed in the JSON results in a .conda package that includes all the paths information. Perhaps it is something particular to conda-constructor (assuming that's how they package Anaconda/Miniconda)?