bug(build): Sapling does not install on Python 3.11
vegerot opened this issue · comments
NOTE: technically Python 3.11 is not supported (at least according to pick_python.py
and the README), however on my machine /usr/local/bin/python3
is 3.11. But since we're probably going to support Python ≥ 3.11 at some point, this is still a valid issue to tackle.
steps to reproduce:
- run
make install-oss
with Python 3.11- this can be tricky because there's no way to specify the Python version. You can hardcode it in the
Makefile
and/orpick_python.py
- this can be tricky because there's no way to specify the Python version. You can hardcode it in the
expected:
Sapling builds and installs successfully
actual:
Sapling builds fine, but installation fails due to an invalid setuptools PEP 440 version:
File "/usr/local/lib/python3.11/site-packages/setuptools/_vendor/packaging/version.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '4.4.2-20230825-130812-08821172816a'
make: *** [install-oss] Error 1
workaround:
explicitly set the version to something unoffensive
SAPLING_VERSION=42.69 make install-oss
probable cause:
as the error message says, "4.4.2-20230825-130812-08821172816a" is not a valid version number according to PEP 440.
We either need to change the format in setup.py/pickversion
or use an alternative to distutils
.
we could simply use .
s instead of -
s:
>>> from setuptools.extern import packaging; packaging.version.Version("4.4.2-20230825-130812-08821172816a")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.11/site-packages/setuptools/_vendor/packaging/version.py", line 197, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '4.4.2-20230825-130812-08821172816a'
>>> from setuptools.extern import packaging; packaging.version.Version("4.4.2.20230825.130812.08821172816a")
<Version('4.4.2.20230825.130812.8821172816a0')>
off-topic: are we using /SAPLING_VERSION for anything?
I was getting this silent failure without using python 3.11, running the build installed by homebrew. I reinstalled from homebrew and it works now. Not reassuring!
A more informative runtime error would be nice.