Trying to fix spontaneously appeared error and don...
# general
f
Trying to fix spontaneously appeared error and don’t understand how to deal with it 🙂 Everything worked correctly (can’t understand which change led to error), and now I’m getting this error on any “test”
Copy code
ProcessExecutionFailure: Process 'Building pytest_runner.pex' failed with exit code 1.
stdout:

stderr:
Failed to resolve requirements from PEX environment @ /home/ubuntu/.cache/pants/named_caches/pex_root/unzipped_pexes/2b66e8069a6e048910ed0b390b2a9da46c51e526.
Needed cp310-cp310-manylinux_2_35_x86_64 compatible dependencies for:
 1: psycopg2-binary
  Required by:
   db 0.1.0
  But this pex had no ProjectName(raw='psycopg2-binary', normalized='psycopg2-binary') distributions.
 2: sqlalchemy
  Required by:
   db 0.1.0
  But this pex had no ProjectName(raw='sqlalchemy', normalized='sqlalchemy') distributions.
Platform is ubuntu. x86_64 here’s the filetree: //3rdparty/python/BUILD
Copy code
python_requirement(name="sqlalchemy",requirements=["sqlalchemy"])
python_requirement(name="psycopg2-binary",requirements=["psycopg2-binary"])
//common/db/BUILD
Copy code
python_distribution(
 name='db',
 provides=setup_py(
  name='db',
  version='0.1.0',
 ),
 dependencies=[":db0"]
)

python_sources(
  name="db0",
  sources=["__init__.py"],
  dependencies=[
   "//3rdparty/python:psycopg2-binary",
   "//3rdparty/python:sqlalchemy"
  ]
)
//lambdas/lambda_pex/BUILD
Copy code
python_awslambda(
  name="lambda",
  runtime="python3.10",
  handler="handler.py:lambda_handler",
)

python_sources(name="lib")
//lambdas/lambda_pex/tests/BUILD
Copy code
python_test(
  name='test_handler',
  source='test_handler.py',
  dependencies=[
    "//lambdas/lambda_pex:lib",
    "//common/db",
  ]
)
pants.toml
Copy code
[GLOBAL]
pants_version = "2.16.0"

backend_packages = [
 "pants.backend.shell",
 "pants.backend.python",
 "pants.backend.docker",
 "pants.backend.awslambda.python"

]

[python]
interpreter_constraints = ["CPython>=3.10"]

[source]
root_patterns = [
 "3rdparty",
 "common",
 "workers",
 "/"
]

[docker]
build_args = [
 "DOCKER_DEFAULT_PLATFORM=linux_x86_64",
]

[environments-preview.names]
linux_docker = "//:linux_docker"

[pex-cli]
version = "v2.1.137"
known_versions = [
 "v2.1.137|macos_arm64|faad51a6a108fba9d40b2a10e82a2646fccbaf8c3d9be47818f4bffae02d94b8|4098329",
 "v2.1.137|macos_x86_64|faad51a6a108fba9d40b2a10e82a2646fccbaf8c3d9be47818f4bffae02d94b8|4098329",
 "v2.1.137|linux_x86_64|faad51a6a108fba9d40b2a10e82a2646fccbaf8c3d9be47818f4bffae02d94b8|4098329",
 "v2.1.137|linux_arm64|faad51a6a108fba9d40b2a10e82a2646fccbaf8c3d9be47818f4bffae02d94b8|4098329"
]
Any ideas what am i doing wrong? Also no lock files
b
perhaps you need to explicitly add the 3rd party deps to the python_test target?
e
@fancy-photographer-78161 my guess is the thing that changed is you installed Python 3.11. Do you really mean
>=3.10
for your interpreter constraints? Is 3.12 beta 3 ok?
f
yet using workaround - “run” command is working. will get back to fixing test command soon. Thanks @boundless-monitor-67068 @enough-analyst-54434