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

Incompatible with Python 3.12 because of pkg_resources use #233

Open
StevenMaude opened this issue Nov 16, 2023 · 0 comments
Open

Incompatible with Python 3.12 because of pkg_resources use #233

StevenMaude opened this issue Nov 16, 2023 · 0 comments

Comments

@StevenMaude
Copy link
Contributor

Traceback (most recent call last):
  File "/tmp/pytest-of-runner/pytest-0/test_packaging_bdist_wheel_whl0/bin/opensafely", line 5, in <module>
    from opensafely import main
  File "/tmp/pytest-of-runner/pytest-0/test_packaging_bdist_wheel_whl0/lib/python3.12/site-packages/opensafely/__init__.py", line 10, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

This doesn't just affect the test because opensafely/__init__.py does the same.

The quick fix is:

easy_install, pkg_resources, setuptools and distutils are no longer provided by default in environments created with venv or bootstrapped with ensurepip, since they are part of the setuptools package. For projects relying on these at runtime, the setuptools project should be declared as a dependency and installed separately (typically, using pip).

https://docs.python.org/3/whatsnew/3.12.html#ensurepip

But a better alternative would be removing the use of pkg_resources, if possible. The use of pkg_resources is deprecated in setuptools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant