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

No module named 'packaging.metadata' #9034

Closed
rga-coding opened this issue Feb 26, 2024 · 10 comments
Closed

No module named 'packaging.metadata' #9034

rga-coding opened this issue Feb 26, 2024 · 10 comments
Labels
kind/bug Something isn't working as expected

Comments

@rga-coding
Copy link

Description

poetry self update downgrades package "packaging" from 23.2 to 20 

After that all poetry command give error 
"No module named 'packaging.metadata'"

Workarounds

don't do poetry self update

Poetry Installation Method

pipx

Operating System

unix

Poetry Version

1.8.0

Poetry Configuration

cache-dir = "/home/jenkins/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.cgk-thycotic.url = "https://gitlab.cegeka.com/api/v4/projects/565/packages/pypi/simple"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/jenkins/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

Stack trace:

  16  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  15  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/console/application.py:188 in _run
       186│         self._disable_cache = io.input.has_parameter_option("--no-cache")
       187│ 
     → 188│         self._load_plugins(io)
       189│ 
       190│         exit_code: int = super()._run(io)

  14  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/console/application.py:354 in _load_plugins
       352│ 
       353│             manager = PluginManager(ApplicationPlugin.group)
     → 354│             manager.load_plugins()
       355│             manager.activate(self)
       356│ 

  13  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/plugins/plugin_manager.py:38 in load_plugins
        36│ 
        37│         for ep in plugin_entrypoints:
     →  38│             self._load_plugin_entry_point(ep)
        39│ 
        40│     @staticmethod

  12  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/plugins/plugin_manager.py:76 in _load_plugin_entry_point
        74│         logger.debug("Loading the %s plugin", ep.name)
        75│ 
     →  76│         plugin = ep.load()  # type: ignore[no-untyped-call]
        77│ 
        78│         if not issubclass(plugin, (Plugin, ApplicationPlugin)):

  11  ~/.pyenv/versions/3.11.8/lib/python3.11/importlib/metadata/__init__.py:202 in load
        200│         """
        201│         match = self.pattern.match(self.value)
     →  202│         module = import_module(match.group('module'))
        203│         attrs = filter(None, (match.group('attr') or '').split('.'))
        204│         return functools.reduce(getattr, attrs, module)

  10  ~/.pyenv/versions/3.11.8/lib/python3.11/importlib/__init__.py:126 in import_module
       124│                 break
       125│             level += 1
     → 126│     return _bootstrap._gcd_import(name[level:], package, level)
       127│ 
       128│ 

   9  <frozen importlib._bootstrap>:1204 in _gcd_import

   8  <frozen importlib._bootstrap>:1176 in _find_and_load

   7  <frozen importlib._bootstrap>:1147 in _find_and_load_unlocked

   6  <frozen importlib._bootstrap>:690 in _load_unlocked

   5  <frozen importlib._bootstrap_external>:940 in exec_module

   4  <frozen importlib._bootstrap>:241 in _call_with_frames_removed

   3  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry_plugin_export/plugins.py:7 in <module>
         5│ from poetry.plugins.application_plugin import ApplicationPlugin
         6│ 
     →   7│ from poetry_plugin_export.command import ExportCommand
         8│ 
         9│ 

   2  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry_plugin_export/command.py:12 in <module>
        10│ from poetry.core.packages.dependency_group import MAIN_GROUP
        11│ 
     →  12│ from poetry_plugin_export.exporter import Exporter
        13│ 
        14│ 

   1  ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry_plugin_export/exporter.py:11 in <module>
         9│ from cleo.io.io import IO
        10│ from poetry.core.packages.dependency_group import MAIN_GROUP
     →  11│ from poetry.repositories.http_repository import HTTPRepository
        12│ 
        13│ from poetry_plugin_export.walker import get_project_dependency_packages

  ModuleNotFoundError

  No module named 'packaging.metadata'

  at ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/repositories/http_repository.py:15 in <module>
       11│ 
       12│ import requests
       13│ import requests.adapters
       14│ 
    →  15│ from packaging.metadata import parse_email
       16│ from poetry.core.constraints.version import parse_constraint
       17│ from poetry.core.packages.dependency import Dependency
       18│ from poetry.core.utils.helpers import temporary_directory
       19│ from poetry.core.version.markers import parse_marker
@rga-coding rga-coding added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Feb 26, 2024
@abn
Copy link
Member

abn commented Feb 26, 2024

Duplicate of #9029

@abn abn marked this as a duplicate of #9029 Feb 26, 2024
@abn abn closed this as completed Feb 26, 2024
@rga-coding
Copy link
Author

@abn
I have Uninstalled poetry like this
curl -sSL https://install.python-poetry.org | python3 - --uninstall
and installed it back like this
curl -sSL https://install.python-poetry.org | python3 -

When I do poetry self update it still installs packaging 23.0 instead of 23.1
Like it says is the MR https://github.com/python-poetry/poetry/pull/9032/files

Am I doing something wrong?

@abn
Copy link
Member

abn commented Feb 26, 2024

Does pipx install poetry perform any better?

@abn
Copy link
Member

abn commented Feb 26, 2024

Am I doing something wrong?

I don't think so, this is likely because poetry when updating is locking the version to 23.0.

@rga-coding
Copy link
Author

Does pipx install poetry perform any better?

I can't use pipx, the server is bein managed by someone else. I can't just install packages.

@abn
Copy link
Member

abn commented Feb 26, 2024

You can install pipx into user site by python -m pip install --user pipx.

You can alternatively go the virtual environment poetry is installed in, typically in ~/.local/share/pypoetry/venv, and then ./bin/python -m pip install -U packaging.

The issue should go away with the next patch release.

@mickeykkim
Copy link

I'm still getting this error with poetry 1.8.1

@clintonroy
Copy link
Contributor

@mickeykkim you'll need to give a lot more details for us to be able to try to reproduce your problem, how are you attempting to install poetry?

@mickeykkim
Copy link

After updating my poetry lockfile, my problem has been fixed. Apologies.

@abn abn removed the status/triage This issue needs to be triaged label Mar 2, 2024
Copy link

github-actions bot commented Apr 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants