openwrt / openwrt/packages

python3-light: cannot import importlib.metadata

Open Beginner friendly
#20,462 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Maintainer: @jefferyto
Environment: x86 / 22.03, x86 / master

Description: python3-light installs importlib.metadata package, that can't be imported

$ docker run --rm  -it openwrtorg/rootfs:x86-64
[...]
root@container:/# opkg update
root@container:/# opkg install python3-light
root@container:/# ls /usr/lib/python3.10/importlib/metadata/
__init__.pyc      _adapters.pyc     _collections.pyc  _functools.pyc    _itertools.pyc    _meta.pyc         _text.pyc
root@container:/# python3 -c "import importlib.metadata"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 6, in <module>
ModuleNotFoundError: No module named 'email'

discovered by : https://github.com/openwrt/packages/issues/20441

It seems it requires at least python3-email and python3-urllib

root@container:/# opkg install python3-email
Installing python3-email (3.10.7-3) to root...
Downloading https://downloads.openwrt.org/snapshots/packages/x86_64/packages/python3-email_3.10.7-3_x86_64.ipk
Configuring python3-email.
root@container:/# python3 -c "import importlib.metadata"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 7, in <module>
  File "/usr/lib/python3.10/pathlib.py", line 14, in <module>
ModuleNotFoundError: No module named 'urllib'
root@container:/# opkg install python3-urllib
Installing python3-urllib (3.10.7-3) to root...
Downloading https://downloads.openwrt.org/snapshots/packages/x86_64/packages/python3-urllib_3.10.7-3_x86_64.ipk
Configuring python3-urllib.
root@container:/# python3 -c "import importlib.metadata"
root@container:/# 

Also found https://github.com/openwrt/packages/issues/12942 by looking around in the issue tracker

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the python3-light package definition and inspect how its runtime dependencies are declared. Reproduce the issue with python3 -c "import importlib.metadata" in the shown OpenWrt image, then verify the import succeeds after installing the package with its required dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.