thousands-plumber-33255
12/18/2023, 12:08 PMactions/setup-python@v5
and running python -V
gives the correct version: 3.11.7
. The problem seems not to be with the tests but finding the correct interpreter. One can see that some tests succeed and then randomly this error occurs:
11:34:39.73 [INFO] Completed: Run Pytest - (environment:local, services/weasyprint_pdf/tests/test_server_responding.py) - succeeded.
11:35:02.36 [INFO] Completed: Run Pytest - (django/dismantling/tests/queries/test_dismantling_project_cost.py:tests and 1 other files, environment:local) - succeeded.
Partition: RUN_TESTS_TOGETHER_TAG
11:35:04.64 [INFO] Completed: Run Pytest - (django/dismantling/tests/classes/test_material.py:tests and 25 other files, environment:local) - succeeded.
Partition: RUN_TESTS_TOGETHER_TAG
11:35:34.77 [INFO] Completed: Run Pytest - (django/spatial/tests/mutations/test_cluster_delete.py:tests and 15 other files, environment:local) - succeeded.
Partition: RUN_TESTS_TOGETHER_TAG
11:35:46.44 [INFO] Completed: Run Pytest - (django/dismantling/tests/queries/test_dismantling_projects.py:tests and 32 other files, environment:local) - succeeded.
Partition: RUN_TESTS_TOGETHER_TAG
11:35:50.45 [INFO] Starting: Building pytest_runner.pex
11:35:50.57 [ERROR] 1 Exception encountered:
Engine traceback:
in `test` goal
ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython<3.12,>=3.11' failed with exit code 102.
stdout:
stderr:
Could not find a compatible interpreter.
Examined the following interpreters:
1.) /usr/bin/python3.8 CPython==3.8.10
No interpreter compatible with the requested constraints was found:
Version matches CPython<3.12,>=3.11
Note: I have disabled remote caching. Ideas what to look out for?thousands-plumber-33255
12/18/2023, 2:34 PMPATH
. What confuses me the most that it is still finding Python 3.8 (previously used version and setup with setup-python action), while on Ubuntu 22.04 the default Python version should be Python 3.10. So it kind of looks like something gets cached. I have deleted all GHA caches just to make sure.thousands-plumber-33255
12/18/2023, 2:57 PMpants --no-pantsd --no-local-cache test ::
curved-television-6568
12/18/2023, 7:04 PMbroad-processor-92400
12/18/2023, 10:19 PMpants.toml
?thousands-plumber-33255
12/19/2023, 9:10 AM[GLOBAL]
# info: change version to update pants
pants_version = "2.16.0"
colors = true
# increasing memory usage for for better in-memory caching and fewer restarts
pantsd_max_memory_usage = "4GiB"
# storing pants log and pants file in one place (persistent because of container volume mount)
pants_workdir = ".cache_and_logs/.pants.d"
pants_subprocessdir = ".cache_and_logs/.pids"
local_store_dir = ".cache_and_logs/.pants_cache"
unmatched_build_file_globs = "error"
# <https://github.com/pantsbuild/pants/issues/17851>
named_caches_dir = "/tmp/pantsbuild/named_caches"
local_execution_root_dir = "/tmp/pantsbuild/"
build_file_prelude_globs = ["pants_plugins/macros.py"]
# also ignoring pgadmin because no read permissions for pgadmin/config
pants_ignore = [
"/.cache_and_logs/",
".*/",
"/dist/",
"/cli/third/md-click",
"/Dockerfile",
"!/django/locale/**",
]
# uncomment to do not use gitignore by default for file visibility
# pants_ignore_use_gitignore = false
backend_packages = [
'pants.backend.python',
"pants.backend.awslambda.python",
'pants.backend.docker',
'pants.backend.docker.lint.hadolint',
'pants.backend.python.typecheck.mypy',
'pants.backend.experimental.python.lint.ruff',
'pants.backend.python.lint.yapf',
]
[tailor]
ignore_adding_targets = [
"django:manage",
"infra/apps/resources/django:docker",
"infra/apps/resources/services:docker",
"infra/apps/resources/replibyte:docker",
]
ignore_paths = ["airflow/dags/**"]
[python]
interpreter_constraints = ["CPython>=%(env.PYTHON_MAJOR_VERSION)s,<3.12"]
enable_resolves = true
default_resolve = "default"
pip_version = "22.3"
[python.resolves_to_constraints_file]
default = "constraints/airflow-2.6.0-py-%(env.PYTHON_MAJOR_VERSION)s.txt"
[python-infer]
#inits = true
init_files = "always"
string_imports = true
string_imports_min_dots = 0
# This setting will ommit warnings about dependency inference as there is a modele `api` in Django
# as well as one with the same name in alle service directories.
ambiguity_resolution = "by_source_root"
[python.resolves]
default = "lockfiles/default.lock"
tools = "lockfiles/tools.lock"
[source]
# source code locations not in use by now
root_patterns = [
"/services",
"/libs/*",
"/django",
"/airflow",
"/pants_plugins",
"/cli",
"/",
"/jobs",
]
[docker]
build_args = [
"VARIANT",
"PYTHON_MAJOR_VERSION",
"ENVIRONMENT",
"IMAGE_TAG",
"DOWNSCALING_ECR_REPO_NAME",
"ELEVATION_ECR_REPO_NAME",
"GEOPACKAGE_ECR_REPO_NAME",
"GLOBALSOLARATLAS_ECR_REPO_NAME",
"HIGHCHARTS_ECR_REPO_NAME",
"INTERPOLATION_ECR_REPO_NAME",
"MVA_ECR_REPO_NAME",
"NEWA_ECR_REPO_NAME",
"QGIS_ECR_REPO_NAME",
"QGIS_ERROR_ECR_REPO_NAME",
"ROUGHNESS_ECR_REPO_NAME",
"WEASYPRINT_ECR_REPO_NAME",
"WEIBULL_ECR_REPO_NAME",
"SPATIAL_IMPORT_ECR_REPO_NAME",
"SENTINEL_IMAGE_LAYER_ECR_REPO_NAME",
]
run_args.add = ["--rm"]
env_vars = [
"DOCKER_BUILDKIT=0"
]
[docker.registries.ecr]
address = "localhost:4510"
default = true
[pytest]
install_from_resolve = "tools"
requirements = [
"//:tools#pytest",
"//:tools#pytest-icdiff",
"//:tools#mixer",
"//:tools#pytest-xdist",
"//:tools#pytest-cov",
]
xdist_enabled = true
config_discovery = true
# db id env var set by pants for using multiple databases for parallel tests
execution_slot_var = "PANTS_EXECUTION_SLOT"
[test]
# set batch size smaller, so that caching is more efficient
batch_size=32
extra_env_vars = ["USE_LOCALSTACK=false"]
[environments-preview.names]
qgis_docker = "//services/qgis_file:local_qgis"
local = "//:local-environment"
[yapf]
config = "pyproject.toml"
install_from_resolve = "tools"
requirements = ["//:tools#yapf"]
[mypy]
config = "pyproject.toml"
install_from_resolve = "tools"
requirements = ["//:tools#mypy"]
[ruff]
config = "pyproject.toml"
install_from_resolve = "tools"
requirements = ["//:tools#ruff"]
[anonymous-telemetry]
# do not send telemetry data
enabled = false
pants.ci.toml
[GLOBAL]
colors = true
# plugins = ["hdrhistogram"]
remote_cache_read = true
remote_cache_write = true
remote_store_address = "<grpcs://remote.buildbuddy.io>"
remote_store_headers = "{'user-agent': 'pants', 'x-buildbuddy-api-key': '%(env.BUILDBUDDY_API_KEY)s'}"
remote_instance_name = "buildbuddy-io/buildbuddy/local"
named_caches_dir = "/tmp/named_caches"
local_execution_root_dir = "/tmp"
rule_threads_core = 4
[docker]
build_args.add = [
"DJANGO_ECR_REPO_NAME",
"GEO_ECR_REPO_NAME",
"AIRFLOW_ECR_REPO_NAME",
"SNAPLET_ECR_REPO_NAME",
]
[stats]
# log = true
[test]
use_coverage = true
[coverage-py]
report = ["xml"]
global_report = true
[pytest]
args = ["-vv", "--no-header"]
[docker.registries.ecr]
address = "%(env.AWS_ACCOUNT_ID)s.dkr.ecr.%(env.AWS_REGION)<http://s.amazonaws.com|s.amazonaws.com>"
default = true
[docker.registries.ghcr]
address = "<http://ghcr.io/nefino|ghcr.io/nefino>"
[environments-preview.names]
local = "//:ci-environment"
qgis_docker = "//services/qgis_file:local_qgis"
We are using GHA hosted runnersthousands-plumber-33255
12/19/2023, 9:42 AMname: Pants setup
inputs:
python-version:
required: true
type: number
runs:
using: composite
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: pantsbuild/actions/init-pants@v5-scie-pants
with:
# cache0 makes it easy to bust the cache if needed
# just increase the integer to start with a fresh cache
gha-cache-key: cache0-py${{ inputs.python-version }}
# The Python backend uses named_caches for Pip/PEX state,
# so it is appropriate to invalidate on lockfile changes.
named-caches-hash: ${{ hashFiles('lockfiles/*.lock') }}
thousands-plumber-33255
12/19/2023, 10:14 AMthousands-plumber-33255
12/19/2023, 10:39 AMbroad-processor-92400
12/19/2023, 9:27 PMthousands-plumber-33255
12/20/2023, 11:21 AMnamed-caches
will never be cached:
Cache not found for input keys: pants-named-caches-Linux-cache0-py3.11-4bec308c3a7cd09c0f6fe2eef84a7cd5d52831f2dbbf9efff4fa68d47a125001-df1f334def1ba179517b10ee3b211097147652919e6d3cc82b815bdc74aa6741, pants-named-caches-Linux-cache0-py3.11-4bec308c3a7cd09c0f6fe2eef84a7cd5d52831f2dbbf9efff4fa68d47a125001-, pants-named-caches-Linux-cache0-py3.11
Something wrong with the settings?thousands-plumber-33255
12/20/2023, 11:23 AM2.20.0dev3
, but no change. Any more ideas @broad-processor-92400 @curved-television-6568 @happy-kitchen-89482?thousands-plumber-33255
12/20/2023, 1:18 PMPATH
env looks like:
/home/runner/bin:/opt/hostedtoolcache/Python/3.11.7/x64/bin:/opt/hostedtoolcache/Python/3.11.7/x64:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Why is pants not recognizing /opt/hostedtoolcache/Python/3.11.7/x64/bin/python
where the python version from setup-python
is located? It looks like in your own CI you are using this actions after setup-python
a few times: https://github.com/pantsbuild/actions/blob/main/expose-pythons/action.yml But I have added this as well and no interpreters are found.
If I add this to my `pants.ci.toml`:
[python-bootstrap]
# Env is exposed by <https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#environment-variables>
search_path = ["/opt/hostedtoolcache/Python/3.11.7/x64/bin/python"]
I simply get:
Could not find a compatible interpreter.
No interpreters could be found on the system.
curved-television-6568
12/20/2023, 3:31 PMsearch_path = ["/opt/hostedtoolcache/Python/3.11.7/x64/bin"]
curved-television-6568
12/20/2023, 3:31 PMhappy-kitchen-89482
12/20/2023, 4:31 PMhappy-kitchen-89482
12/20/2023, 4:32 PMcache0
part to cache1
etchappy-kitchen-89482
12/20/2023, 4:33 PMthousands-plumber-33255
12/20/2023, 4:33 PMcurved-television-6568
12/20/2023, 4:34 PMthousands-plumber-33255
12/20/2023, 4:35 PMhappy-kitchen-89482
12/20/2023, 4:35 PMhappy-kitchen-89482
12/20/2023, 4:36 PMthousands-plumber-33255
12/20/2023, 4:36 PMhappy-kitchen-89482
12/20/2023, 4:49 PMthousands-plumber-33255
12/20/2023, 5:00 PMthousands-plumber-33255
12/20/2023, 5:17 PMhappy-kitchen-89482
12/20/2023, 8:04 PMhappy-kitchen-89482
12/20/2023, 8:05 PMhappy-kitchen-89482
12/20/2023, 8:09 PMthousands-plumber-33255
12/21/2023, 10:47 AMdocker_environment
which uses an image where Python 3.8 is installed. This was a tough one as there was no hint to look out for other environments 😄curved-television-6568
12/21/2023, 10:53 AMcurved-television-6568
12/21/2023, 10:53 AMthousands-plumber-33255
12/21/2023, 10:57 AM