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

pulp-cli==0.23.0 gives pulpcore.cli.deb.context is not a package #874

Closed
JeppeKlitgaard opened this issue Jan 17, 2024 · 6 comments · Fixed by #880
Closed

pulp-cli==0.23.0 gives pulpcore.cli.deb.context is not a package #874

JeppeKlitgaard opened this issue Jan 17, 2024 · 6 comments · Fixed by #880
Assignees
Labels
bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg

Comments

@JeppeKlitgaard
Copy link

Summary

Since the release yesterday of pulp-cli version 0.23.0 can no longer install pulp-cli.

Steps to reproduce

In a Debian container running:

pipx install pulp-cli==0.23.0 && pipx inject pulp-cli setuptools && pipx inject pulp-cli pulp-cli-deb

Fails with the following stacktrace:

Traceback (most recent call last):
  File "/root/.local/bin/pulp", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 36, in main
    load_plugins()
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 22, in load_plugins
    discovered_plugins: Dict[str, ModuleType] = {
                                                ^
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulp_cli/__init__.py", line 23, in <dictcomp>
    entry_point.name: entry_point.load()
                      ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulpcore/cli/deb/__init__.py", line 6, in <module>
    from pulpcore.cli.deb.content import content
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulpcore/cli/deb/content.py", line 24, in <module>
    from pulpcore.cli.deb.context import (
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulpcore/cli/deb/context.py", line 16, in <module>
    translation = get_translation(__name__)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/pipx/venvs/pulp-cli/lib/python3.11/site-packages/pulp_glue/common/i18n.py", line 32, in get_translation
    localedir = files(name) / "locale"
                ^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/resources/_common.py", line 22, in files
    return from_package(get_package(package))
                        ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/resources/_common.py", line 55, in get_package
    raise TypeError(f'{package!r} is not a package')
TypeError: 'pulpcore.cli.deb.context' is not a package

Changing to 0.22.0 fixes this:

pipx install pulp-cli==0.22.0 && pipx inject pulp-cli setuptools && pipx inject pulp-cli pulp-cli-deb

This can be reproduced with the following Containerfile:

FROM debian:bookworm-slim

# Build custom build image here
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    pipx

# Set up PATH to capture pipx binaries
ENV PATH=/root/.local/bin:$PATH

# Install pulp-cli for distribution of artifacts
# RUN pip3 install pulp-cli pulp-cli-deb
RUN pipx install pulp-cli==0.23.0 && pipx inject pulp-cli setuptools && pipx inject pulp-cli pulp-cli-deb

# Set up pulp
RUN pulp config create --base-url=http://packages --username=admin --password=${PULP_ADMIN_PASSWORD} --no-verify-ssl
@JeppeKlitgaard JeppeKlitgaard added bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg labels Jan 17, 2024
@mdellweg
Copy link
Member

Can you confirm that this is an incompatibility between pulp-cli-deb and pulp-cli~=0.23? Is pulp-cli alone fine?

@JeppeKlitgaard
Copy link
Author

Running pipx install pulp-cli on its own in a clean Debian container works. It seems it is just incompatible with the pulp-cli-deb plugin.

@mdellweg
Copy link
Member

Thanks for checking. I'm currently sorting out this exact issue with pulp-cli-gem.

mdellweg added a commit to mdellweg/pulp-cli that referenced this issue Jan 22, 2024
In 0.23 a regression was introduced that forced the use of
`get_translation(__package__)` instead of `get_translation(__name__`).
This change adds a fallback to allow the old style alongside.
It may however be removed in the future.

Fixes pulp#874
mdellweg added a commit to mdellweg/pulp-cli that referenced this issue Jan 22, 2024
In 0.23 a regression was introduced that forced the use of
`get_translation(__package__)` instead of `get_translation(__name__`).
This change adds a fallback to allow the old style alongside.
It may however be removed in the future.

Fixes pulp#874
@mdellweg mdellweg self-assigned this Jan 22, 2024
mdellweg added a commit that referenced this issue Jan 22, 2024
In 0.23 a regression was introduced that forced the use of
`get_translation(__package__)` instead of `get_translation(__name__`).
This change adds a fallback to allow the old style alongside.
It may however be removed in the future.

Fixes #874
patchback bot pushed a commit that referenced this issue Jan 22, 2024
In 0.23 a regression was introduced that forced the use of
`get_translation(__package__)` instead of `get_translation(__name__`).
This change adds a fallback to allow the old style alongside.
It may however be removed in the future.

Fixes #874

(cherry picked from commit 197c548)
mdellweg added a commit that referenced this issue Jan 22, 2024
In 0.23 a regression was introduced that forced the use of
`get_translation(__package__)` instead of `get_translation(__name__`).
This change adds a fallback to allow the old style alongside.
It may however be removed in the future.

Fixes #874

(cherry picked from commit 197c548)
@mdellweg
Copy link
Member

Would you be so kind confirming that this is actually fixed with 0.23.2?

@abotelho-cbn
Copy link

[root@el9 bin]# ./pulp --version
Traceback (most recent call last):
  File "/opt/pulp-cli/bin/./pulp", line 8, in <module>
    sys.exit(main())
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 1077, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 943, in make_context
    self.parse_args(ctx, args)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 1644, in parse_args
    rest = super().parse_args(ctx, args)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 1408, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 2400, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/click/core.py", line 2362, in process_value
    value = self.callback(ctx, self, value)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulp_cli/__init__.py", line 75, in _config_profile_callback
    _load_config(ctx)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulp_cli/__init__.py", line 127, in _load_config
    ctx.meta[PLUGIN_KEY] = load_plugins(enabled_plugins)
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulp_cli/__init__.py", line 39, in load_plugins
    discovered_plugins: t.Dict[str, ModuleType] = {
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulp_cli/__init__.py", line 40, in <dictcomp>
    entry_point.name: entry_point.load()
  File "/opt/pulp-cli/lib64/python3.9/site-packages/importlib_metadata/__init__.py", line 184, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulpcore/cli/deb/__init__.py", line 6, in <module>
    from pulpcore.cli.deb.content import content
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulpcore/cli/deb/content.py", line 24, in <module>
    from pulpcore.cli.deb.context import (
  File "/opt/pulp-cli/lib64/python3.9/site-packages/pulpcore/cli/deb/context.py", line 4, in <module>
    from pulpcore.cli.common.context import (
ModuleNotFoundError: No module named 'pulpcore.cli.common.context'

Is this the same error? I'm getting this on pulp-cli 0.29.1 in a venv with pulp-cli-deb installed alongside it.

@mdellweg
Copy link
Member

Is this the same error? I'm getting this on pulp-cli 0.29.1 in a venv with pulp-cli-deb installed alongside it.

No, sorry. There's nothing i can do for you. This is just bad design of pip. It recklessly breaks installed packages for the sake of satisfying your last request to pip install(*). In this case, there is not version of pulp-cli-deb as of yet that is compatible with pulp-cli >= 0.28. Somehow you ended up installing these anyway.

*) Curiously enough, I have seen pip printing an error message about incompatible installed packages that will be broken, and still continue without asking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (template-set) Triage-Needed Needs to be reviewed at next pulp-cli mtg
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants