acoustic-library-86413
10/29/2023, 3:57 PMpex_binary(
name="prefect",
script="prefect",
dependencies=["3rdparty/python#prefect", "projects/path/to/my/code"],
layout="loose",
execution_mode="venv"
)
If I package this PEX and run it from the dist folder the server starts as expected. If I create a Docker image that copies the very same PEX and runs it, it fails with:
server-1 | Failed to find compatible interpreter on path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
server-1 |
server-1 | Examined the following interpreters:
server-1 | 1.) /usr/local/bin/python3.11 CPython==3.11.3
server-1 |
server-1 | No interpreter compatible with the requested constraints was found:
server-1 |
server-1 | Failed to resolve requirements from PEX environment @ /bin/prefect.
server-1 | Needed cp311-cp311-manylinux_2_28_x86_64 compatible dependencies for:
server-1 | 1: pendulum<3.0.0,>=2.1.2
server-1 | Required by:
server-1 | prefect 2.14.2
server-1 | But this pex had no ProjectName(raw='pendulum', normalized='pendulum') distributions.
Can anyone point me in the right direction of why it would work in one scenario and not in the other? I feel like the Pendulum dependency should fail in either case. Based on what I can tell from the following issue Pendulum appears to have an issue with its wheels for 3.11.3. How would I work around this with Pants?acoustic-library-86413
10/29/2023, 3:58 PMpython_requirements
file to specify that Prefect depends on it. Using pants dependencies --transitive
on the PEX lists pendulum as a dependency.acoustic-library-86413
10/29/2023, 4:05 PMhappy-kitchen-89482
10/29/2023, 5:10 PMhappy-kitchen-89482
10/29/2023, 5:14 PMhappy-kitchen-89482
10/29/2023, 5:14 PMhappy-kitchen-89482
10/29/2023, 5:15 PMzip -t
to look at its manifest and see what wheels are embedded in it.acoustic-library-86413
10/29/2023, 6:03 PMacoustic-library-86413
10/29/2023, 6:11 PMplatforms
on the PEX to platforms=["linux_x86_64-cp-3.11.3-cp3.11.3"]. This results in:
stderr:
No pre-built wheel was available for pendulum 2.1.2.
Successfully built the wheel pendulum-2.1.2-cp39-cp39-manylinux_2_35_x86_64.whl from the sdist pendulum-2.1.2.tar.gz but it is not compatible with the requested foreign target abbreviated platform cp311-cp311cp3.11.3-linux_x86_64.
You'll need to build a wheel from pendulum-2.1.2.tar.gz on the foreign target platform and make it available to Pex via a `--find-links` repo or a custom `--index`.
acoustic-library-86413
10/29/2023, 6:19 PMhappy-kitchen-89482
10/29/2023, 8:25 PMhappy-kitchen-89482
10/29/2023, 8:26 PMhappy-kitchen-89482
10/29/2023, 8:26 PMacoustic-library-86413
10/29/2023, 8:57 PMpex3 interpreter inspect --markers --tags
to generate a platforms file for me, but get an error saying Invalid environment entry provided: pex.pep_508.MarkerEnvironment() argument after ** must be a mapping, not str
. This seems strange. It would be beneficial to have an example file present in the documentation for complete_platforms.acoustic-library-86413
10/29/2023, 9:00 PMacoustic-library-86413
10/29/2023, 10:12 PM{
"compatible_tags": [
"cp311-cp311-manylinux_2_35_x86_64",
"cp311-cp311-manylinux_2_34_x86_64",
"cp311-cp311-manylinux_2_33_x86_64",
...
],
"marker_environment": {
"implementation_name": "cpython",
"implementation_version": "3.11.3",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "6.2.0-35-generic",
"platform_system": "Linux",
"platform_version": "#35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 6 10:23:26 UTC 2",
"python_full_version": "3.11.3",
"python_version": "3.11",
"sys_platform": "linux"
}
}
With this as the platform-file and interpreter constraints globally limited to 3.11.3 OR 3.11.4 I still get the following message:
stderr:
No pre-built wheel was available for pendulum 2.1.2.
Successfully built the wheel pendulum-2.1.2-cp39-cp39-manylinux_2_35_x86_64.whl from the sdist pendulum-2.1.2.tar.gz but it is not compatible with the requested foreign target complete platform cp311-cp311-manylinux_2_35_x86_64.
You'll need to build a wheel from pendulum-2.1.2.tar.gz on the foreign target platform and make it available to Pex via a `--find-links` repo or a custom `--index`
I read this as if Pants is trying to use 3.9.X as its intepreter when building the pex?enough-analyst-54434
10/30/2023, 6:33 AM_2_X_
tags. Those represent the glibc version installed on the machine (2.26
) and lower. In other words this describes a CPython 3.11 interpreter installed on a machine with glibc 2.26 that is compatible with all platform specific wheels that link glibc 2.26 or older.
Now you appear to be using two Linux systems that only share a kernel (this is how containers work). One system has glibc 2.25 installed, one 2.28. If you build a platform specific wheel on the 2.28 system, the 2.25 system will not be able to use it. The other direction should work though (and this is where I can't make the details line up from the discussion above).
As to your Python 3.9 complaint, that's a Pants issue, but also a bit of a red herring. What you're seeing there is Pex doing a last ditch build and pray hail mary. If you get lucky, great. If not, you should buckle down and do the obvious thing, build native software on the actual platform it's intended to run on.acoustic-library-86413
10/30/2023, 8:06 AMldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.4) 2.35
When we exec into the actual container running the software we find the following:
root@890c125fec46:/srv# ldd --version
ldd (Debian GLIBC 2.28-10+deb10u2) 2.28
That's unfortunate. I'll see if I can upgrade the glibc version in the container.acoustic-library-86413
10/30/2023, 8:20 AMacoustic-library-86413
10/30/2023, 8:27 AMacoustic-library-86413
10/30/2023, 9:30 AMI guess I can also just build the wheel directly in a container and upload it to our internal package index.Just did this with great success 🙂
enough-analyst-54434
10/30/2023, 9:30 AM_2_28_
and then consecutive lower glibc versions through _2_25_
. So I've given you an obvious failure case: build against 2.28 does not work against 2.25, but, IIUC, your situation is the opposite.acoustic-library-86413
10/30/2023, 9:31 AMenough-analyst-54434
10/30/2023, 9:31 AM