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

mamba uninstall cudatoolkit fails (conda equivalent works) #1770

Open
pierreglaser opened this issue Jun 29, 2022 · 11 comments
Open

mamba uninstall cudatoolkit fails (conda equivalent works) #1770

pierreglaser opened this issue Jun 29, 2022 · 11 comments

Comments

@pierreglaser
Copy link

Steps to reproduce: in a shell, run:

mamba create -n condaforgecuda cudatoolkit
mamba uninstall -n condaforgecuda cudatoolkit

First line works fine, second fails with:

Removing specs: ['cudatoolkit']
Transaction

  Prefix: /nfs/nhome/live/pierreg/.local/miniforge/envs/condaforgecuda

  Removing specs:

   - cudatoolkit


  Package          Version  Build        Channel         Size
───────────────────────────────────────────────────────────────
  Remove:
───────────────────────────────────────────────────────────────

  - __glibc           2.31  0            installed
  - _libgcc_mutex      0.1  conda_forge  conda-forge
  - _openmp_mutex      4.5  2_gnu        conda-forge
  - cudatoolkit     11.7.0  hd8887f6_10  conda-forge
  - libgcc-ng       12.1.0  h8d9b700_16  conda-forge
  - libgomp         12.1.0  h8d9b700_16  conda-forge
  - libstdcxx-ng    12.1.0  ha89aaad_16  conda-forge

  Summary:

  Remove: 7 packages

  Total download: 0 B

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

Confirm changes: [Y/n] Y

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/conda/_vendor/boltons/setutils.py", line 247, in remove
        didx = self.item_index_map.pop(item)
    KeyError: PackageRecord(_hash=-1097009890971377200, name='__glibc', version='2.31', build='0', build_number=0, channel=Channel("@"), subdir='linux-64', fn='__glibc', md5='12345678901234567890123456789012', package_type='virtual_system')

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/conda/exceptions.py", line 1114, in __call__
        return func(*args, **kwargs)
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/mamba.py", line 935, in exception_converter
        raise e
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/mamba.py", line 929, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/mamba.py", line 887, in _wrapped_main
        result = do_call(args, p)
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/mamba.py", line 752, in do_call
        exit_code = remove(args, parser)
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/mamba.py", line 240, in remove
        conda_transaction = to_txn(
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/utils.py", line 432, in to_txn
        final_precs = compute_final_precs(
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/mamba/utils.py", line 367, in compute_final_precs
        final_precs.remove(i_rec)
      File "/nfs/nhome/live/pierreg/.local/miniforge/lib/python3.9/site-packages/conda/_vendor/boltons/setutils.py", line 249, in remove
        raise KeyError(item)
    KeyError: PackageRecord(_hash=-1097009890971377200, name='__glibc', version='2.31', build='0', build_number=0, channel=Channel("@"), subdir='linux-64', fn='__glibc', md5='12345678901234567890123456789012', package_type='virtual_system')

`$ /nfs/nhome/live/pierreg/.local/miniforge/bin/mamba uninstall -n condaforgecuda cudatoolkit`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=base
                CONDA_EXE=/nfs/nhome/live/pierreg/.local/miniforge/bin/conda
             CONDA_PREFIX=/nfs/nhome/live/pierreg/.local/miniforge
    CONDA_PROMPT_MODIFIER=(base)
         CONDA_PYTHON_EXE=/nfs/nhome/live/pierreg/.local/miniforge/bin/python
               CONDA_ROOT=/nfs/nhome/live/pierreg/.local/miniforge
              CONDA_SHLVL=1
           CURL_CA_BUNDLE=<not set>
                  MANPATH=::/opt/puppetlabs/puppet/share/man
               MODULEPATH=/etc/environment-modules/modules:/usr/share/modules/versions:/usr/shar
                          e/modules/modulefiles:/ceph/apps/ubuntu-20/modulefiles
                     PATH=/nfs/nhome/live/pierreg/.local/miniforge/bin:/nfs/nhome/live/pierreg/.
                          local/bin:/nfs/nhome/live/pierreg/.local/bin:/nfs/nhome/live/pierreg/.
                          local/bin:/nfs/nhome/live/pierreg/.local/miniforge/bin:/nfs/nhome/live
                          /pierreg/.local/miniforge/condabin:/usr/local/sbin:/usr/local/bin:/usr
                          /sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/p
                          uppetlabs/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /nfs/nhome/live/pierreg/.local/miniforge
            shell level : 1
       user config file : /nfs/nhome/live/pierreg/.condarc
 populated config files : /nfs/nhome/live/pierreg/.local/miniforge/.condarc
          conda version : 4.13.0
    conda-build version : not installed
         python version : 3.9.9.final.0
       virtual packages : __cuda=11.6=0
                          __linux=5.4.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /nfs/nhome/live/pierreg/.local/miniforge  (writable)
      conda av data dir : /nfs/nhome/live/pierreg/.local/miniforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /nfs/nhome/live/pierreg/.local/miniforge/pkgs
                          /nfs/nhome/live/pierreg/.conda/pkgs
       envs directories : /nfs/nhome/live/pierreg/.local/miniforge/envs
                          /nfs/nhome/live/pierreg/.conda/envs
               platform : linux-64
             user-agent : conda/4.13.0 requests/2.28.0 CPython/3.9.9 Linux/5.4.0-109-generic ubuntu/20.04.2 glibc/2.31
                UID:GID : 801150913:801150913
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

conda uninstall -n condaforgecuda cudatoolkit works fine.

Base env spec (shortened):

conda                     4.13.0           py39hf3d152e_1    conda-forge
conda-package-handling    1.8.1            py39hb9d737c_1    conda-forge
mamba                     0.24.0           py39hfa8f2c8_1    conda-forge
@hmaarrfk
Copy link
Contributor

I've seen this problem with non-cuda packages too.

It seems that mamba is trying to uninstall __glibc a virtual package, which is breaking things. That is my guess.

@ihnorton
Copy link

ihnorton commented Mar 29, 2023

Seeing this with distributed due to __unix virtual package.

Removing specs: ['distributed']
Transaction

  Prefix: /Users/inorton/opt/conda/envs/pydev

  Removing specs:

   - distributed


  Package                Version  Build               Channel         Size
────────────────────────────────────────────────────────────────────────────
  Remove:
────────────────────────────────────────────────────────────────────────────

  - __unix                     0  0                   installed
  - bokeh                  2.4.3  pyhd8ed1ab_3        conda-forge
  - brotlipy               0.7.0  py310h8e9501a_1005  conda-forge
  - cryptography          38.0.4  py310hfc83b78_0     conda-forge
  - cytoolz               0.12.0  py310h8e9501a_1     conda-forge
  - dask               2022.12.0  pyhd8ed1ab_0        conda-forge
  - dask-core          2022.12.0  pyhd8ed1ab_0        conda-forge
  - distributed        2022.12.0  pyhd8ed1ab_0        conda-forge
  - fsspec             2022.11.0  pyhd8ed1ab_0        conda-forge
  - heapdict               1.0.1  py_0                conda-forge
  - idna                     3.4  pyhd8ed1ab_0        conda-forge
  - locket                 1.0.0  pyhd8ed1ab_0        conda-forge
  - lz4                    4.0.2  py310ha6df754_0     conda-forge
  - msgpack-python         1.0.4  py310h2887b22_1     conda-forge
  - partd                  1.3.0  pyhd8ed1ab_0        conda-forge
  - pyopenssl             22.1.0  pyhd8ed1ab_0        conda-forge
  - pysocks                1.7.1  pyha2e5f31_6        conda-forge
  - pyyaml                   6.0  py310h8e9501a_5     conda-forge
  - tblib                  1.7.0  pyhd8ed1ab_0        conda-forge
  - toolz                 0.12.0  pyhd8ed1ab_0        conda-forge
  - typing_extensions      4.4.0  pyha770c72_0        conda-forge
  - urllib3              1.26.13  pyhd8ed1ab_0        conda-forge
  - yaml                   0.2.5  h3422bc3_2          conda-forge
  - zict                   2.2.0  pyhd8ed1ab_0        conda-forge

  Summary:

  Remove: 24 packages

  Total download: 0 B

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

Confirm changes: [Y/n] y
PackageRecord(_hash=-711664884171206039, name='__unix', version='0', build='0', build_number=0, channel=Channel("@"), subdir='osx-arm64', fn='__unix', md5='12345678901234567890123456789012', package_type='virtual_system')

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/conda/_vendor/boltons/setutils.py", line 206, in remove
        didx = self.item_index_map.pop(item)
    KeyError: PackageRecord(_hash=-711664884171206039, name='__unix', version='0', build='0', build_number=0, channel=Channel("@"), subdir='osx-arm64', fn='__unix', md5='12345678901234567890123456789012', package_type='virtual_system')

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/conda/exceptions.py", line 1082, in __call__
        return func(*args, **kwargs)
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/mamba.py", line 935, in exception_converter
        raise e
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/mamba.py", line 928, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/mamba.py", line 886, in _wrapped_main
        result = do_call(parsed_args, p)
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/mamba.py", line 752, in do_call
        exit_code = remove(args, parser)
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/mamba.py", line 240, in remove
        conda_transaction = to_txn(
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/utils.py", line 436, in to_txn
        final_precs = compute_final_precs(
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/mamba/utils.py", line 371, in compute_final_precs
        final_precs.remove(i_rec)
      File "/Users/inorton/opt/conda/lib/python3.9/site-packages/conda/_vendor/boltons/setutils.py", line 208, in remove
        raise KeyError(item)
    KeyError: PackageRecord(_hash=-711664884171206039, name='__unix', version='0', build='0', build_number=0, channel=Channel("@"), subdir='osx-arm64', fn='__unix', md5='12345678901234567890123456789012', package_type='virtual_system')

`$ /Users/inorton/opt/conda/condabin/mamba uninstall distributed`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=pydev
                CONDA_EXE=/Users/inorton/opt/conda/bin/conda
             CONDA_PREFIX=/Users/inorton/opt/conda/envs/pydev
           CONDA_PREFIX_1=/Users/inorton/opt/conda
    CONDA_PROMPT_MODIFIER=
         CONDA_PYTHON_EXE=/Users/inorton/opt/conda/bin/python
               CONDA_ROOT=/Users/inorton/opt/conda
              CONDA_SHLVL=2
           CURL_CA_BUNDLE=<not set>
                 INFOPATH=/opt/homebrew/share/info:
                  MANPATH=/opt/homebrew/share/man::
                     PATH=/Users/inorton/.sdkman/candidates/java/current/bin:/Users/inorton/.bun
                          /bin:/Users/inorton/.deno/bin:/Users/inorton/opt/conda/envs/pydev/bin:
                          /Users/inorton/opt/conda/condabin:/Users/inorton/.cargo/bin:/Users/ino
                          rton/bin:/Users/inorton/go/bin:/Users/inorton/.npm-global/bin:/opt/hom
                          ebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/s
                          bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Ap
                          plications/Wireshark.app/Contents/MacOS:/Users/inorton/.dotnet/tools
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : pydev
    active env location : /Users/inorton/opt/conda/envs/pydev
            shell level : 2
       user config file : /Users/inorton/.condarc
 populated config files : /Users/inorton/opt/conda/.condarc
                          /Users/inorton/.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.13.final.0
       virtual packages : __osx=12.6=0
                          __unix=0=0
                          __archspec=1=arm64
       base environment : /Users/inorton/opt/conda  (writable)
      conda av data dir : /Users/inorton/opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/inorton/opt/conda/pkgs
                          /Users/inorton/.conda/pkgs
       envs directories : /cmn/condaenvs
                          /Users/inorton/opt/conda/envs
                          /Users/inorton/.conda/envs
               platform : osx-arm64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.13 Darwin/21.6.0 OSX/12.6
                UID:GID : 501:20
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

[edit]: x-ref #2129 (comment) which looks to be the same issue.
[edit2]: did the uninstall with conda succesfully (which removed much more than mamba was planning to) and then reinstalled w/ mamba

@vipcxj
Copy link

vipcxj commented Apr 11, 2023

The same issue! Any news?

@jonashaag
Copy link
Collaborator

Can you try upgrading Mamba and Conda to the latest versions?

@oliver-batchelor
Copy link

Can you try upgrading Mamba and Conda to the latest versions?

I'm seeing the same thing with the latest mamba 1.4.2. Mamba is trying to uninstall __unix

@oliver-batchelor
Copy link

It also occurs with the libmamba solver on conda:

conda uninstall torchvision torchaudio 
Channels:
 - nvidia
 - pytorch
 - conda-forge
 - defaults
 - anaconda
 - robostack
 - omnia
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: - WARNING conda.conda_libmamba_solver.solver:_export_solved_records(685): Tried to unlink __unix but it is not installed or manageable?
done

@peppapighs
Copy link

peppapighs commented Jun 12, 2023

I encounter this problem trying to remove gdb as well. It tries to remove __glibc.

@ziyuanzhao2000
Copy link

ziyuanzhao2000 commented Aug 2, 2023

Any solution? I encountered this while trying to remove a custom built package.

It tries to remove __linux:

KeyError: PackageRecord(_hash=-6054808270103221154, name='__linux', version='4.18.0', build='0', build_number=0, channel=Channel("@"), subdir='linux-64', fn='__linux', md5='12345678901234567890123456789012', package_type='virtual_system')

Edit: after updating mamba from 1.1.0 to 1.4.9 the problem goes away. So perhaps other people seeing related problems can try updating their mamba and see if it works.

@iamthebot
Copy link

iamthebot commented Sep 13, 2023

I can confirm this is still an issue with mamba 1.5.1 with the __glibc virtual package. This occurs when uninstalling matplotlib. The only workaround for now is to keep conda around without libmamba-solver and use it for uninstallation.

Interestingly the ARM build doesn't seem to have this issue.

@ogrisel
Copy link
Contributor

ogrisel commented Oct 19, 2023

I believe I experienced the same problem when trying to use conda-lock for a macOS build (same KeyError message). #2923 should fix this.

@asw28
Copy link

asw28 commented Nov 18, 2023

Same problem here with huggingface datasets on macos:

KeyError: PackageRecord(_hash=-5592555481460673488, name='__osx', version='12.1', build='0', build_number=0, channel=Channel("@"), subdir='osx-64', fn='__osx', md5='12345678901234567890123456789012', package_type='virtual_system')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests