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

Error with package __osx when removing package ipykernel on macOS #2129

Closed
errubec opened this issue Nov 21, 2022 · 6 comments · Fixed by #2923
Closed

Error with package __osx when removing package ipykernel on macOS #2129

errubec opened this issue Nov 21, 2022 · 6 comments · Fixed by #2923
Labels
type::bug Something isn't working

Comments

@errubec
Copy link

errubec commented Nov 21, 2022

I was trying to remove an unneeded installation of ipykernel from my environment with mamba remove ipykernel. However, the process reports the following error (reformatted):

File "/Users/<myname>/mambaforge/lib/python3.10/site-packages/conda/_vendor/boltons/setutils.py", line 249, in remove
        raise KeyError(item)
    KeyError: PackageRecord(_hash=-7575337989302587721,
        name='__osx', version='13.0.1', build='0', build_number=0,
        channel=Channel("@"), subdir='osx-arm64', fn='__osx',
        md5='12345678901234567890123456789012',
        package_type='virtual_system'
    )

An inspection of ipykernel dependencies list the following package named __osx:

Package Version Build Channel
__osx 13.0.1 0 installed

Apparently this package is some representation of the underlying operating system and cannot be 'removed' like an ordinary package, but the remove script doesn't appear to be handling it differently, causing the error and failing to uninstall ipykernel at all.

Is there a way to fix this?

@jonashaag
Copy link
Collaborator

What’s your mamba version?

@errubec
Copy link
Author

errubec commented Nov 21, 2022

@jonashaag Thanks for getting back to me.

What’s your mamba version?

I get

mamba 1.0.0
conda 22.9.0

from mamba --version.

@jonashaag jonashaag added the type::bug Something isn't working label Nov 21, 2022
@jonashaag
Copy link
Collaborator

Thanks, sounds like a bug then

@bstadlbauer
Copy link

Also just ran into this. Not sure how tricky this would be to implement, but in case it's just a small change happy to help out

@wolfv
Copy link
Member

wolfv commented Jan 10, 2023

@bstadlbauer yes, just filtering out packages with __ in front would do it :)

@beenje
Copy link

beenje commented Jan 20, 2023

I got the same issue on Linux with __unix:

$ mamba --version
mamba 1.1.0
conda 22.11.1

$ mamba create -y -n foo flask python=3.10
$ mamba remove -n foo flask

  Removing specs:

   - flask


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

  - __unix                    0  0                  installed
  - click                 8.1.3  unix_pyhd8ed1ab_2  conda-forge
  - flask                 2.2.2  pyhd8ed1ab_0       conda-forge
  - importlib-metadata    6.0.0  pyha770c72_0       conda-forge
  - itsdangerous          2.1.2  pyhd8ed1ab_0       conda-forge
  - jinja2                3.1.2  pyhd8ed1ab_1       conda-forge
  - markupsafe            2.1.2  py310h1fa729e_0    conda-forge
  - python_abi             3.10  3_cp310            conda-forge
  - werkzeug              2.2.2  pyhd8ed1ab_0       conda-forge
  - zipp                 3.11.0  pyhd8ed1ab_0       conda-forge


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

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/opt/conda/lib/python3.10/site-packages/conda/exceptions.py", line 1118, in __call__
        return func(*args, **kwargs)
      File "/opt/conda/lib/python3.10/site-packages/mamba/mamba.py", line 936, in exception_converter
        raise e
      File "/opt/conda/lib/python3.10/site-packages/mamba/mamba.py", line 929, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
      File "/opt/conda/lib/python3.10/site-packages/mamba/mamba.py", line 887, in _wrapped_main
        result = do_call(parsed_args, p)
      File "/opt/conda/lib/python3.10/site-packages/mamba/mamba.py", line 752, in do_call
        exit_code = remove(args, parser)
      File "/opt/conda/lib/python3.10/site-packages/mamba/mamba.py", line 240, in remove
        conda_transaction = to_txn(
      File "/opt/conda/lib/python3.10/site-packages/mamba/utils.py", line 436, in to_txn
        final_precs = compute_final_precs(
      File "/opt/conda/lib/python3.10/site-packages/mamba/utils.py", line 371, in compute_final_precs
        final_precs.remove(i_rec)
      File "/opt/conda/lib/python3.10/site-packages/conda/_vendor/boltons/setutils.py", line 249, in remove
        raise KeyError(item)
    KeyError: PackageRecord(_hash=7108678122529742155, name='__unix', version='0', build='0', build_number=0, channel=Channel("@"), subdir='linux-64', fn='__unix', 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
type::bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants