Use shutil instead of distutils.spawn?
Currently setuptools
is broken with PyPy on macOS x86_64 if pkg_resources
is imported first:
> conda create -c conda-forge --name test setuptools pypy
> conda activate test
> python -c 'import setuptools, pkg_resources; print("All good")'
All good
> python -c 'import pkg_resources, setuptools; print("All good")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/cburr/mambaforge/envs/test/site-packages/setuptools/__init__.py", line 35, in <module>
__version__ = setuptools.version.__version__
AttributeError: module 'setuptools' has no attribute 'version'
I reported it in pypa/setuptools#3165 and the issue seems to be caused by the interaction between PyPy importing distutils
in _sysconfigdata
and the fragility of _distutils_hack
. A possible workaround would be to avoid importing distutils
in _sysconfigdata
by applying:
- from distutils.spawn import find_executable
+ from shutil import which as find_executable
Would this be acceptable from PyPy's perspective? (for Python 3 at least)