I'm trying to setup a Java project using Pants in Linux — specifically Arch Linux.
I'm following the documentation to just install it, but I'm always getting an error when running ./pants --version:
$ ./pants --version
Invalid Python interpreter version for /usr/bin/python3. For `pants_version = "2.12.0"`, Pants requires Python 3.7, 3.8, or 3.9 to run
I do have Python 3.9.9 installed via asdf and activated for the sub-directory in question.
$ python --version
Python 3.9.9
Moreover, my configuration already have Python 3.x installed as well by default. So even if I disable the asdf version I do have it in the system:
$ python --version
Python 3.10.5
Is there a way to just overcome this issue? I still don't understand why the pants script is unable to discover the Python interpreter. I do really prefer to use the local version that asdf "activates" because any time the system updates it will probably update the version to one that would be incompatible at some point.
There is an option to overcome this issue in
pants.toml:This basically means
Pantswill first theASDFinterpreter with the version in<BUILD_ROOT>/.tool-versionsand then what's inPATH.Regardless, the setup process is all too titchy still and the
systemversion must be set as well.I filed an issue in the
Pantsrepository and that's where I got the help from. I'm just documenting what's there here.