I tripped on this error when attempting to do Guix builds for macOS from a debian host.
doc: guix: add lzma python tip #24504
pull jamesob wants to merge 1 commits into bitcoin:master from jamesob:2022-03-xcode-extract-doc changing 1 files +7 −0-
jamesob commented at 4:40 PM on March 8, 2022: member
-
ce5a0c7583
doc: guix: add lzma python tip
I tripped on this error when attempting to do Guix builds for macOS from a debian host.
- DrahtBot added the label Scripts and tools on Mar 8, 2022
-
luke-jr commented at 6:32 PM on March 8, 2022: member
Why would you have to reinstall Python? Debian doesn't compile it, so shouldn't the package be the same regardless?
-
jamesob commented at 6:46 PM on March 8, 2022: member
When building the shared libs (
--enable-shared), if the lzma header is missing Python apparently just skips it. I build my Python from source so I'm not sure how this might work with Debian packaging. -
laanwj commented at 11:26 AM on March 9, 2022: member
I'm kind of confused here. How does installing headers make a Python package appear? Only if you build Python afterward?
I think it would be better to handle this as a required build check/dependency, e.g. through the conventional
requirements.txtsystem.Specific instructions related to building Python from source is out of scope for this document, i think, as it's definitely not a specific need here. You only need a Python with the
lzmapackage. -
jamesob commented at 6:49 PM on March 9, 2022: member
haha okay, well this comment would've probably saved me fifteen minutes but I guess it's out of scope. Will close.
- jamesob closed this on Mar 9, 2022
-
jamesob commented at 6:56 PM on March 9, 2022: member
Just for posterity...
All Python installations ship with the
lzma.pyfile below, but (I guess) if you compile Python without having the lzma headers installed, you don't get the.sofile alongside it:% ls /usr/local/lib/python3.10/*lzma* /usr/local/lib/python3.10/_lzma.cpython-39-x86_64-linux-gnu.so /usr/local/lib/python3.10/lzma.pywhich then causes the following import to fail:
% grep _lzma /usr/local/lib/python3.10/lzma.py from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_propertiesI don't know why Python builds don't require the lzma headers if this is part of the standard library, but apparently you can have a "valid" Python installation built from source (as I did) that lacks this shared object file.
-
JeremyRubin commented at 8:00 PM on March 9, 2022: contributor
concept ack
if you can figure out the minimal set of optional things required to build the python we need, that would be awesome. there are probably some things you got lucky on!
we could even add a python-check script to ensure we have all the components not erroring.
this is a good first step!
- DrahtBot locked this on Mar 9, 2023