Skip to content

ModuleNotFoundError: No module named 'pkg_resources' with setuptools >=80 (Python 3.12) #116

@Gurkiratcodemaster

Description

@Gurkiratcodemaster

Environment

  • OS: Ubuntu 22.04 (also reproduced on Windows 11)
  • Python version: 3.12.3
  • Atarashi version: 0.0.11
  • Installed via: pip install atarashi
  • setuptools version installed automatically: 82.0.0

Issue Description

After installing Atarashi using:

pip install atarashi

Running:

atarashi -h

results in:

ModuleNotFoundError: No module named 'pkg_resources'

Traceback:

from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'

Error with setuptools 82.0.0

The following screenshot shows the failure when using the automatically installed setuptools (82.0.0):

Error with setuptools 82.0.0


Working After Downgrading setuptools

After downgrading setuptools:

pip install setuptools==69.5.1 --force-reinstall

Atarashi runs successfully.

Screenshot of successful execution:

Working with setuptools 69.5.1


Investigation

The project declares:

setuptools (>=80.9.0,<81.0.0)

However, in Python 3.12 environments with setuptools >=80,
pkg_resources does not appear to be reliably available.

Atarashi imports:

from pkg_resources import resource_filename

This import fails even though setuptools is installed.

Downgrading setuptools to 69.5.1 restores expected behavior.


Root Cause (Likely)

pkg_resources is considered legacy and is being phased out in modern packaging workflows.

With newer setuptools versions (>=80), its availability appears inconsistent in Python 3.12 environments.

Since Atarashi requires Python >=3.10, it could safely use:

importlib.resources

which is part of the Python standard library and does not require setuptools at runtime.


Suggested Fix

One of the following:

  1. Replace usage of pkg_resources with importlib.resources
    (recommended modern solution)

OR

  1. Adjust setuptools dependency constraints to a version range
    that reliably includes pkg_resources

Additional Notes

  • Reproducible on multiple machines
  • Reproducible on both Ubuntu and Windows
  • Appears to be a runtime compatibility issue rather than a local environment problem

Happy to test any proposed fixes or help with a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions