Closed MarkCarbonell98 closed 9 months ago
I think this will be an upstream issue - looks like a PartitionAlloc assertion failed (probably while attempting to load the library?). It reminds me of https://github.com/pypdfium2-team/pypdfium2/issues/154, which was a PartitionAlloc permission error with Docker. Feel free to report this upstream.
In the meantime, you could try to build pdfium from source without PartitionAlloc and craft your own pypdfium2 wheel with the resulting binary. The syslibs build is PartitionAlloc-disabled, or you could patch "pdf_use_partition_alloc": False
into the default config.
Example:
sudo apt-get install -y libfreetype-dev liblcms2-dev libjpeg-dev libopenjp2-7-dev libpng-dev zlib1g-dev libicu-dev libtiff-dev
python3 ./setupsrc/pypdfium2_setup/build_pdfium.py --use-syslibs
PDFIUM_PLATFORM="sourcebuild" python3 -m build --wheel -nx
python3 -m pip install -v dist/pypdfium2-*-py3-none-linux_x86_64.whl
pypdfium2 -v # output should include the "sourcebuild" keyword
I cannot reproduce the issue with latest pdfium on Fedora 37, so it seems to be specific to your setup.
BTW, theoretically this was the wrong issue template - I'd have intended you to use "PyPA install" rather than "Generic issue". But the report included all I needed to see, so nevermind. It's a common mistake. If you have an idea how to improve the templates wording, that might be helpful.
FATAL:partition_address_space.cc(77)
I think this is the file/line in question: https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator/+/fc98a25dea359f8d1f15e57d9278d81da73c7a09/src/partition_alloc/partition_address_space.cc#77
@MarkCarbonell98 Does python-test.py
pass when called directly, i.e. not through PHP?
Pdfium binaries are now built without partitionalloc, so I'll close this issue: https://github.com/bblanchon/pdfium-binaries/issues/148 It'd be nice if you could test & report back with the next release, which is scheduled for approx 2 weeks from now.
@mara004 when executing only python-test.py
the script works. But when I call it through PHP it creates this error
Hmm. Are you aware of any memory/allocation-related restrictions in PHP?
I experimented with your samples (calling a python script from PHP), but nothing seemed to happen: when adding prints I didn't see any output, and sleeps didn't result in a delay.
The latest pdfium-binaries release should be PartitionAlloc-free, so you could try to install pypdfium2 from source (git main), which will implicitly download the latest binary, and see if it works now.
Checklist
Reason for Generic issue (keyword/topic)
Pypdfium2 might not work when installed with pip on almalinux server
Description
Versions:
Python version:
Installation made with:
pip3.11 install --no-build-isolation -U pypdfium2
PHP version:
How to reproduce:
pip3.11 install --no-build-isolation -U pypdfium2
python-test.py
)php php-test.php
and observe the error coming from the pdfium binary: