<#20550 pants lockfile generation doesn't respect ...
# github-notifications
c
#20550 pants lockfile generation doesn't respect the hermetic python configuration Issue created by suriya92 Describe the bug Pants lockfile generation looks for a local system interpreter rather than installing the required version on its own with
pants.backend.python.providers.experimental.pyenv
configured in
pants.toml
Pants version 2.17.0 OS MacOS Additional info While running the following command,
./pants generate-lockfiles resolve=default
without the required python interpreter in my system, pants throws the following error rather than installing the required python versions by itself which is expected as per the hermetic python feature.
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.*
Related contents from `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",
]
pantsbuild/pants