i'm having an issue with scie-pants (i think) when...
# general
m
i'm having an issue with scie-pants (i think) when i install pants, it pulls in the python version that my project requires, but then when i try to run a command with pants, it complains it can't find that interpreter:
Copy code
circleci@ip-10-0-38-20:~/project$ pants run
Downloading <https://github.com/indygreg/python-build-standalone/releases/download/20240107/cpython-3.9.18%2B20240107-x86_64->
...
Bootstrapping Pants 2.17.0
Installing pantsbuild.pants==2.17.0 into a virtual environment at /home/circleci/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.17.0
New virtual environment successfully created at /home/circleci/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.17.0

circleci@ip-10-0-38-20:~/project$ pants run src/python/circleci/ppv.py
20:17:04.04 [ERROR] 1 Exception encountered:
No interpreter compatible with the requested constraints was found:
  Version matches CPython==3.9.*

$ find . -name python3.9 -executable
./.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/include/python3.9
./.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9
./.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/bin/python3.9
./.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/pex_root/venvs/10065e08ffb3b880c0f2fc1126cc528a64b9e10b/a8b7ed897053d112610c105ff3a4ea4284431535/lib/python3.9
./.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/pex_root/venvs/10065e08ffb3b880c0f2fc1126cc528a64b9e10b/a8b7ed897053d112610c105ff3a4ea4284431535/bin/python3.9
./.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.17.0/lib/python3.9
./.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.17.0/bin/python3.9
b
Pants involves multiple interpreters: • One to execute itself, the one you’ve found there • Any interpreters for executing user code The first one is only used for executing itself, it’s an implementation detail we’re free to change whenever. You need to provide interpreters for user code separately.
As in, have them installed on the system.
m
aha i wonder if i it would be a possible (and a good idea) to configure (or code) pants to install an interpreter for the project as well
p
if you're using CircleCI Docker image for your executor, it's setup a little weird. It defaults to using system Python but has the requested version installed with pyenv (but not set to be first on PATH). I had to add
Copy code
PANTS_PYTHON_BOOTSTRAP_SEARCH_PATH: "['/home/circleci/.pyenv/shims']"
m
i am using circleci but i prefer to make my setups agnostic of the ci system, and having pants setup the app/project interpreter would work for humans too