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

Python 3.12: ModuleNotFoundError: No module named 'setuptools' #279

Closed
hugovk opened this issue Sep 13, 2023 · 1 comment
Closed

Python 3.12: ModuleNotFoundError: No module named 'setuptools' #279

hugovk opened this issue Sep 13, 2023 · 1 comment

Comments

@hugovk
Copy link
Contributor

hugovk commented Sep 13, 2023

The second Python 3.12 release candidate is out! 🚀

Call to action

We strongly encourage maintainers of third-party Python projects to prepare their projects for 3.12 compatibilities during this phase, and where necessary publish Python 3.12 wheels on PyPI to be ready for the final release of 3.12.0.

Python 3.12.0 final will be released in 3 weeks: https://peps.python.org/pep-0693/

See also https://dev.to/hugovk/help-test-python-312-beta-1508/


However, when adding 3.12 to tox.ini, it fails with:

❯ tox -e py312
.pkg: install_requires> python -I -m pip install 'setuptools>=42' wheel
.pkg: _optional_hooks> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_wheel> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: install_requires_for_build_wheel> python -I -m pip install wheel
.pkg: prepare_metadata_for_build_wheel> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_sdist> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py312: install_package> python -I -m pip install --force-reinstall --no-deps /private/tmp/pyrsistent/.tox/.tmp/package/1/pyrsistent-0.19.3.tar.gz
py312: commands[0]> python /private/tmp/pyrsistent/setup.py test
Traceback (most recent call last):
  File "/private/tmp/pyrsistent/setup.py", line 2, in <module>
    from setuptools import setup, Extension
ModuleNotFoundError: No module named 'setuptools'
py312: exit 1 (0.02 seconds) /private/tmp/pyrsistent> python /private/tmp/pyrsistent/setup.py test pid=69264
.pkg: _exit> python /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  py312: FAIL code 1 (8.58=setup[8.57]+cmd[0.02] seconds)
  evaluation failed :( (8.68 seconds)

This will be due to the setuptools changes in Python 3.12:

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.12/whatsnew/3.12.html#ensurepip

See also gitpython-developers/GitPython#1640 (comment) for more advice.

@tobgu
Copy link
Owner

tobgu commented Oct 18, 2023

setuptools is now installed as part of the test requirements and tests pass on 3.12.

@tobgu tobgu closed this as completed Oct 18, 2023
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

2 participants