virtualenv
virtualenv copied to clipboard
distutils/setuptools: need to provide _distutils_system_mod
setuptools added support for a _distutils_system_mod override file to distutils.
https://github.com/pypa/setuptools/pull/2896
This allows packaging systems to override particular distutils defaults with their preferred solution.
This is how pkgsrc uses the override file:
# _distutils_system_mod
import distutils.sysconfig
vars(distutils.sysconfig).update(
_makefile_tmpl='config-{python_ver}{build_flags}',
_sysconfig_name_tmpl='_sysconfigdata_{platform}',
)
Virtualenv does not seem to be aware of this file, and does not copy it in the virtual environments. Thus installing packages will fail in such virtual environments. Example bug report: https://github.com/joyent/pkgsrc/issues/323
The error is
ModuleNotFoundError: No module named '_sysconfigdata__sunos5_'
because the override for _sysconfig_name_tmpl is not considered, because the _distutils_system_mod file is not available in the virtual environment.
Please copy this file (.../site-packages/_distutils_system_mod.py) if it is available.
A PR trying to achieve this would be welcome 👍 (with changelog entry and tests).
@gaborbernat I know nothing about the codebase. Any pointers on where I should look first? Thanks.
Likely around here https://github.com/pypa/virtualenv/blob/main/src/virtualenv/create/via_global_ref/api.py#L93-L100
With 3.12 no longer adding setuptools this is no longer valid.