dazzling-elephant-33766
10/16/2023, 4:43 PM[environments-preview.names]
linux = "//:linux"
macos = "//:macos"
docker = "//:docker"
local_environment(
name="macos",
compatible_platforms=["macos_arm64"],
)
local_environment(
name="linux",
compatible_platforms=["linux_x86_64"],
fallback_environment="docker",
)
docker_environment(
name="docker",
platform="linux_x86_64",
image="multiply_base",
python_bootstrap_search_path=["<PATH>"],
)
In my google cloud function I’ve tagged the environment as linux
and I can see it’s using the docker environment I’ve specified above
python_google_cloud_function(
name="cloud_function",
runtime="python311",
handler="./main.py:example",
type="http",
environment="linux",
dependencies=["//:reqs0#greenlet"]
)
when I run pants package fns:cloud_function
to package my cloud function / target I get the following error
A distribution for greenlet could not be resolved for cp311-cp311-linux_x86_64.
Found 1 distribution for greenlet that do not apply:
1.) The wheel tags for greenlet 3.0.0 are cp311-cp311-manylinux_2_24_x86_64, cp311-cp311-manylinux_2_28_x86_64 which do not match the supported tags of cp311-cp311-linux_x86_64:
cp311-cp311-manylinux2014_x86_64
It’s complaining that cp311-cp311-manylinux_2_24_x86_64 != cp311-cp311-linux_x86_6
for a particular package.
What’s the usual solution for this kind of error? I’ve loosely specified everything in my BUILD
as linux_x86_64
but this doesn’t seem to satisfy pex.
When building regular pex binaries this seems to work fine, it’s only when using the cloud_function
target.curved-television-6568
10/16/2023, 4:47 PMcomplete_platforms
to get predictable results.dazzling-elephant-33766
10/16/2023, 5:16 PMcurved-television-6568
10/16/2023, 5:34 PMcurved-television-6568
10/16/2023, 5:34 PMdazzling-elephant-33766
10/16/2023, 5:49 PMdocker_environment(
name="docker",
platform="linux_x86_64",
image="multiply_base",
python_bootstrap_search_path=["<PATH>"],
)
So I launched that exact docker image, installed pex and ran pex3 interpreter inspect --markers --tags
to list of complete platforms. Copied that into a platform.json
file
Then added:
file(name="platform", source="platform.json")
python_google_cloud_function(
name="cloud_function",
runtime="python311",
handler="./main.py:example",
type="http",
environment="linux",
dependencies=["//:reqs0#greenlet"],
complete_platforms=["//:platform"],
)
And it’s made some progress because now I’m getting a different error
A single target is required for creating a flat sys.path directory entry.
There were 2 targets selected:
1. cp311-cp311-linux_x86_64
2. cp311-cp311-manylinux_2_36_x86_64
Will keep looking and see what I findcurved-television-6568
10/16/2023, 5:51 PMplatform
field from your docker envcurved-television-6568
10/16/2023, 5:51 PMdazzling-elephant-33766
10/16/2023, 5:56 PMlinux/arm64, actual: linux/amd64
I tried removing the platform and just using python:3.11-slim
and I get the same
A single target is required for creating a flat sys.path directory entry.
There were 2 targets selected:
1. cp311-cp311-linux_x86_64
2. cp311-cp311-manylinux_2_36_x86_64
curved-television-6568
10/16/2023, 5:59 PMdazzling-elephant-33766
10/16/2023, 6:48 PMruntime
field in my gcloud function target
https://pantsbuild.slack.com/archives/C046T6T9U/p1695999511516069?thread_ts=1695900193.739879&cid=C046T6T9Ucurved-television-6568
10/16/2023, 7:06 PM