question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named 'importlib_metadata' with python3.8

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

When I run poetry run with python3.8 I get this error:

0.25s$ poetry run flake8 .
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.8.0/bin/poetry", line 5, in <module>
    from poetry.console import main
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/console/application.py", line 7, in <module>
    from .commands import AboutCommand
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/console/commands/__init__.py", line 4, in <module>
    from .check import CheckCommand
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/console/commands/check.py", line 1, in <module>
    from poetry.factory import Factory
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/factory.py", line 15, in <module>
    from .json import validate_object
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/poetry/json/__init__.py", line 4, in <module>
    import jsonschema
  File "/home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/jsonschema/__init__.py", line 31, in <module>
    import importlib_metadata
ModuleNotFoundError: No module named 'importlib_metadata'

Link to the CI: https://travis-ci.org/sobolevn/flake8-positional-only/jobs/600167655#L368

I have tried to:

  1. Run poetry with -vvv - no change in the result
  2. Install importlib_metadata manually inside the venv and the root system
  3. Install poetry via pip and via curl (curl has different issue, see #1377)

No luck.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
decathorpecommented, Nov 15, 2019

This is probably caused by a typo in this line: https://github.com/sdispater/poetry/blob/481d81d/pyproject.toml#L58

It should be < 3.8, not <= 3.8.

2reactions
florimondmancacommented, Nov 3, 2019

Also experimenting this issue on Python 3.8.0 / TravisCI: https://travis-ci.com/florimondmanca/ddtrace-asgi/jobs/252426060

I managed to fix the issue by installing using the latest Poetry version via get-poetry.py:

before_install:
  - curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py > get-poetry.py
  - python get-poetry.py -y --version 1.0.0b3
  - source ~/.poetry/env

install:
  - poetry install -v

Successful build here: https://travis-ci.com/florimondmanca/ddtrace-asgi/jobs/252427083

Not sure what the origin of the issue is, nor why it is only affecting 3.8 — perhaps a clash between importlib_metadata / importlib.metadata / Poetry’s own vendorized dependencies?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Fixed] ModuleNotFoundError: No module named 'importlib ...
How to Fix “ModuleNotFoundError: No module named 'importlib-metadata'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >
No module named 'importlib.metadata' - python - Stack Overflow
Try installing this lib manually, using : pip install importlib-metadata. or. pip3 install importlib-metadata.
Read more >
Using importlib.metadata — Python 3.11.1 documentation
importlib_metadata is a library that provides access to the metadata of an installed Distribution Package, such as its entry points or its top-level...
Read more >
importlib-metadata - PyPI
This package supplies third-party access to the functionality of importlib. metadata including improvements added to subsequent Python versions.
Read more >
ModuleNotFoundError: No module named 'importlib-metadata'
After the installation of importlib-metadata python library, ModuleNotFoundError: No module named 'importlib-metadata' error will be solved.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found