I have a toy fastapi app, and i want to bundle uvi...
# general
i
I have a toy fastapi app, and i want to bundle uvicorn into the pex. If my requirements are
Copy code
python_requirement(
    name="fastapi",
    requirements=["fastapi==0.75.2"],
)

python_requirement(
    name="uvicorn",
    requirements=["uvicorn==0.17.6"],
)
Then I can get a package without problems (at least during build, it doesn’t quite run how I want to yet, but that’s another question) If I update the uvicorn dependency to be
uvicorn[standard]==0.17.6
then I see something like this (with different packages failing on each run:
Copy code
22:13:20.62 [INFO] Completed: Building app/app_binary.pex with 2 requirements: fastapi==0.75.2, uvicorn[standard]==0.17.6
22:13:20.62 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Building app/app_binary.pex with 2 requirements: fastapi==0.75.2, uvicorn[standard]==0.17.6' failed with exit code 1.
stdout:

stderr:
ERROR: Could not find a version that satisfies the requirement websockets>=10.0; extra == "standard" (from uvicorn[standard])
ERROR: No matching distribution found for websockets>=10.0; extra == "standard"
What am I missing?
1
h
Which version of Pants is this? And are you using lockfiles? And which platform are you running all this on?
i
It’s Pants 2.10, running without lockfiles on intel mac, python 3.8.
h
Hmm, I don't reproduce this on the same environment.
Are you able to put together a tiny github repo that reproduces the problem? Sorry for the trouble!
i
I’m seeing this in CI on an ubuntu container too Here’s the code: https://github.com/mmusnjak/pants-extras
./pants package app:app_binary
and
./pants package app:app_image
both fail in the same way
h
👀
OK so this does reproduce on my machine. Now to see what is different between this and my own attempt to recreate the scenario.
Right, so this doesn't fail if I comment out the
platforms=["linux_x86_64-cp-3.8-cp38m"],
line in the pex_binary target
so this is related to that somehow
Ah, you want that platform string to be
linux_x86_64-cp-3.8-cp38
(without the trailing
m
).
That
m
is relevant to 3.6 and 3.7 only AFAIK
cp38m
is not a valid ABI
i
Thank you! That works perfectly!