Hi all, I'm using the pyenv provider from pants by...
# general
a
Hi all, I'm using the pyenv provider from pants by adding
pants.backend.python.providers.experimental.pyenv
to backend_packages, but when I set the following interpreter constraints :
Copy code
[python]
interpreter_constraints = ["==3.10.*"]
interpreter_versions_universe = ["3.10"]
I'm running into the following error,
Copy code
stderr:
When creating a universal lock with an --interpreter-constraint, an interpreter matching the constraint must be found on the local system but none was: Could not find a compatible interpreter.

Examined the following interpreters:
1.)    /opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/bin/python3.11 CPython==3.11.5
2.)       /opt/homebrew/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/bin/python3.9 CPython==3.9.18
3.) /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 CPython==3.9.6

No interpreter compatible with the requested constraints was found:

  Version matches CPython==3.10.*
I expect pants to provide the compatible python versions(python 3.10 in this case) rather than using the local interpreter. Clearing the cache didn't help too, anyone have any thoughts? Thanks in advance !
b
Sorry for the trouble, What command are you running? Can you share more of your
pants.toml
?
a
Thank you for looking into this. This is the command I'm running:
./pants generate-lockfiles resolve=default
Here are the related contents from my
pants.toml
Copy code
[GLOBAL]
pants_version = "2.17.0"
pythonpath = ["%(buildroot)s/build-support/plugins"]
colors = true

backend_packages = [
  "pants.backend.python.lint.pyupgrade",
  "pants.backend.python.lint.autoflake",
  "pants.backend.python.lint.docformatter",
  "pants.backend.python.lint.isort",
  "pants.backend.python.lint.black",
  "pants.backend.python.lint.flake8",
  "pants.backend.python.lint.pylint",
  "pants.backend.python.typecheck.mypy",
  "pants.backend.python",
  "pants.backend.shell.lint.shellcheck",
  "pants.backend.shell.lint.shfmt",
  "pants.backend.shell",
  "pants.backend.awslambda.python",
  "pants.backend.plugin_development",                  
  "pants.backend.python.providers.experimental.pyenv",
  "pdlbuild.bundles",
  "pdlbuild.pulumi",
  "pdlbuild.service",
  "pdlbuild.django",
]

[python]
interpreter_constraints = ["==3.10.*"]
interpreter_versions_universe = ["3.10"]
# Mostly to enable codegen functions like manage.py collectstatic
default_run_goal_use_sandbox = false
pip_version = "23.1.2"

# Resolves
enable_resolves = true
default_resolve = "default"
resolves.default = "build-support/lockfiles/default.lock"
resolves_to_interpreter_constraints = { "default" = ["==3.10.*"] }

[python-bootstrap]
search_path = ["<PATH>"]
names = ["python3.10", "python3.9", "python3", "python"]

[subprocess-environment]
# workaround for installing native dependencies on M1 macs
env_vars.add = [
  "HDF5_DIR",
  "CFLAGS",
  "LDFLAGS",
  "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1",
  "GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1",
  "CI",
]
b
Thanks! @bitter-ability-32190 anything leap out to you about the pyenv provider here?
b
Yeah, the rules likely aren't using the right Request type that includes the
python
that points to the pyenv-installed Python
You'll have to find where that plugin hooks into, and then work backwards from the
generate-lockfiles
process 😭
b
Ah, so it’s a bug in lockfile generation? Thanks for finding it @agreeable-shampoo-91351 ! Is there a chance you make a reduced reproducer and file an issue?
✅ 1
b
That's my best guess, yeah
a
@agreeable-shampoo-91351 ! Is there a chance you make a reduced reproducer and file an issue?
Done, https://github.com/pantsbuild/pants/issues/20550
b
Thank you!
a
@broad-processor-92400 @bitter-ability-32190 Is someone looking into the above bug? Would be helpful to know if there is an update.
b
No-one I know of. Are you interested in trying your hand at fixing it?