Okay.. I created a complete platforms json with `p...
# general
p
Okay.. I created a complete platforms json with
pex3 interpreter inspect --markers --tags
. After building a pex and putting it onto the host I'm seeing an issue with a package.
Copy code
No interpreter compatible with the requested constraints was found:

  A distribution for cffi could not be resolved for /usr/bin/python3.9.
  Found 1 distribution for cffi that do not apply:
  1.) The wheel tags for cffi 1.15.1 are cp39-cp39-manylinux_2_17_aarch64, cp39-cp39-manylinux2014_aarch64 which do not match the supported tags of /usr/bin/python3.9:
  cp39-cp39-manylinux_2_33_armv7l
  ... 409 more ...
I can install
cffi-1.15.1-cp39-cp39-linux_aarch64.whl
via pip.. is there a way to tell cffi to care about this platform? Or do I just add to the complete platform command 🤔
e
So armv71 vs aarch64 - are you sure you ran
pex3 interpreter inspect
with the correct python? You should really use
--python this/one/here
to be sure / explicit.
In short though, having to edit complete platforms by hand is a really bad idea - better to figure out what is wrong with the generation process - which really can only be describing the wrong interpreter.
p
Yeah I figured I shouldn't edit the complete platform json file In terms of python I have
Copy code
root@fc8fa89:/usr/src/app# ls -la /usr/bin/python*
lrwxrwxrwx 1 root root       9 Apr  6  2021 /usr/bin/python3 -> python3.9
lrwxrwxrwx 1 root root      16 Apr  6  2021 /usr/bin/python3-config -> python3.9-config
-rwxr-xr-x 1 root root 3888592 Nov 18  2021 /usr/bin/python3.9
lrwxrwxrwx 1 root root      36 Nov 18  2021 /usr/bin/python3.9-config -> arm-linux-gnueabihf-python3.9-config
Running
Copy code
pex3 interpreter inspect --markers --tags --python=$(which python3)
Makes no difference unfortunately.
Copy code
root@fc8fa89:/usr/src/app# pex3 interpreter inspect 
/usr/bin/python3.9
e
What version of Pex? Maybe try 2.1.140 which has latest
packaging
which is what calcs tags.
p
On the latest unfortunately 😕
Copy code
root@fc8fa89:/usr/src/app# pex3 --version
2.1.140
root@fc8fa89:/usr/src/app# pex --version
2.1.140
e
Hrm.
So, like a raspberry pi board?
p
Correct
Copy code
root@fc8fa89:/usr/src/app# cat /proc/cpuinfo 
processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Hardware	: BCM2835
Revision	: d03115
Serial		: 100000000c3111d0
Model		: Raspberry Pi 4 Model B Rev 1.5
e
But the complete platform somehow doesn't have armv71 tags in it? Can you gist the complete platform generated from the raspberry pi python 3.9?
p
Yup. One second
e
Ok, it does have armv71 tags, but just those. That makes sense. Your error doesn't make sense - the PEX should never have built in the 1st place, because, I'd guess, 0 pre-built wheels for anything for armv71 exist on PyPI. Do you have a custom index or find links?
What is the pex_binary target I guess in full?
Is it a multiplatform PEX?
p
I have one find links for a libcamera aarch64 file https://storage.googleapis.com/exclosure-whls/index.html
The pex binary is
Copy code
pex_binaries(
    name="binaries",
    entry_points=["manager.py", "server.py"],
    complete_platforms=["//.build/complete_platforms:python_39_rpi4_debian_buster"],
)
e
Ok, but 0 armv71 wheels?
p
In the pex file? Let me look
e
No - in your index
p
Ah in the index yes only x86_64 and aarch64
e
So, platforms and complete platforms only work if all wheels are pre-built
There are 0 pre built wheels for armv71 out in the world I'd guess.
That's niche. You'd need to pre-built and host them.
But, as I said, that should've show up as a PEX build error earlier.
p
Yeah I had that error with psutil, but we addressed it 🤔
e
How?
p
I removed the dependency
e
Ok you didn't actually address
p
I think we are both right 😉 Just different angles.
e
Yeah, so this is a bad strategy for you unless you commit to pre-building wheels for armv71
Since that's what platforms and complete platforms require.
It is not a cross building feature. The builds must be pre done.
For cross building Pants only has docker_environment.
I still don't understand how the PEX built for you at all.
p
The pex is populated with aarch64?
Copy code
.deps$ ls | grep aar
cffi-1.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
charset_normalizer-3.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
google_crc32c-1.5.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
grpcio-1.49.1-cp39-cp39-manylinux_2_17_aarch64.whl
libcamera-0.0.4-cp39-cp39-linux_aarch64.whl
MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
numpy-1.24.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
pandas-2.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Pillow-9.5.0-cp39-cp39-manylinux_2_28_aarch64.whl
protobuf-4.23.4-cp37-abi3-manylinux2014_aarch64.whl
PyWavelets-1.4.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
rpds_py-0.8.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
scikit_image-0.20.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
scipy-1.9.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
sgp4-2.22-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
e
And that was built with a complete platforms of only armv71 tags? I don't believe you.
p
Would you like to screen share?
e
No.
Ok. I have sort of stepped away from Pants. But from the Pex side, failure to build is the expected result.
So, you're claiming
pex --complete-platform yours scipy -o script.pex
works and contains aarch64 wheels?
p
Okay you are correct phew I did
Copy code
pkill pantsd
rm -r .pants.d
rm -r ~/.cache/pants
And now it is complaining. So maybe a caching error? I rebuilt a few times.
e
Sounds like it. I have stepped away from Pants and am not sure about its quirks on top here, but Pex should definitely fail the PEX build.
But, yeah - so you have a pretty big problem supporting raspberry PI unless you can: 1. Run pants on it. 2. Use docker_environment to build the pex_binary in. 3. Pre-build raspberry pi wheels via some out of band process and make thos available to Pants via a custom index or find-links repo.
p
I can add a worker to build barn, was hoping not too, but I can.
e
I see no other option. What the heck do you do today?
p
They build on the raspberry pi's in https://www.balena.io/ infrastructure.
e
So basically 1.
s/pants/pip/
p
Was trying to save time by cross compiling pex.
e
yeah pex does not do cross-compile
p
Sorry not compile. Package the appropriate wheels into a pex
e
The issue is the appropriate wheels do not exist.
The complete platforms feature will definitely work to "Package the appropriate wheels into a pex" but it needs the pre-built wheels in order to do so.
p
Yup. I fully understand that. I had a "thing" building when I added the complete platform.. but maybe a caching issue.
e
Yeah.
p
Curious why pex finds arm but pip3 install does the aarch? 🤔
e
FWIW complete platforms was initially just the hacky platforms thing and Twitter added / used that + an OOB process that looked at requirements.txt and pre-built wheels for all prod platforms and served them up ona custom index for Pants / Pex to use.
pip3 runniing on raspeberry py?
p
Yes sir.
e
So - it has access to the compiler!
Pants / Pex do not, they do not run on raspberry pi - right?
pip is building from sdist on raspberry pi - its not finding a pre built wheel either.
try nuking the pip cache on a pi and
pip --log log.txt install ...
then read the log.
p
Pants / Pex do not, they do not run on raspberry pi - right?
Correct. I was trying to create a pex file on x86 for rpi4 via complete platforms.
e
Yes - exactly. So you're asking Pants / Pex to either be able to cross build for raspberry pi if no wheel exists or else use a pre-built wheel.
p
Yes.. we agree on that.
e
Since Pex doesn't cross build, and pants only does via docker - there you are,
Pex will yell at you and fail fast. Pants clearly gave you a silent non-error cache bug confusing thing.
p
Agreed 😿
e
Ok. I think I've given you all the help I can. If you can repro the Pants issue with steps, an issue with those repro steps would clearly be gold Pants maintainers would love.
p
Thank you for the help. I'll see if I can reproduce it 😃