Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install on alpine - dependency issue with qpdf #497

Closed
Fran-Rg opened this issue Jul 21, 2023 · 7 comments
Closed

Unable to install on alpine - dependency issue with qpdf #497

Fran-Rg opened this issue Jul 21, 2023 · 7 comments

Comments

@Fran-Rg
Copy link

Fran-Rg commented Jul 21, 2023

This recently started to happen, here's how to reproduce:

docker run --platform=linux/amd64 --rm -it --entrypoint='' python:3.10-alpine3.17  /bin/sh
 
apk update
apk add --no-cache gcc g++ py3-pikepdf py3-cairo-dev qpdf-dev
pip install --upgrade pip
pip install pikepdf>=3.0

The issue:

      src/core/job.cpp: In lambda function:
      src/core/job.cpp:117:65: error: 'class QPDFJob' has no member named 'createQPDF'
        117 |             [](QPDFJob &job) { return std::shared_ptr<QPDF>(job.createQPDF()); },
            |                                                                 ^~~~~~~~~~
      src/core/job.cpp: In function 'void init_job(pybind11::module_&)':
      src/core/job.cpp:120:23: error: 'writeQPDF' is not a member of 'QPDFJob'
        120 |             &QPDFJob::writeQPDF,
            |                       ^~~~~~~~~
      In file included from /tmp/pip-build-env-77jnlrj4/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/../attr.h:13,
                       from /tmp/pip-build-env-77jnlrj4/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/detail/class.h:12,
                       from /tmp/pip-build-env-77jnlrj4/overlay/lib/python3.10/site-packages/pybind11/include/pybind11/pybind11.h:13,

Am I missing something?

@Fran-Rg
Copy link
Author

Fran-Rg commented Jul 21, 2023

The issue looks to come from the 7.2.0 to 8.X.X version.
pip install pikepdf==7.2.0 works

@jbarlow83
Copy link
Member

pikepdf does not have binary wheels for Alpine Linux, since Alpine does not use glibc. I have tried to get wheels to work, but it's very complicated since many dependencies in the Alpine Linux wheel builder image are too old. As such, installing on Alpine will trigger a source build, as it does for many Python packages.

The easiest solution would be to use a lightweighter glibc based Docker image. The whole Python packaging ecosystem works better with glibc.

The version of libqpdf shipped by alpine is too old. You will need to get a newer version (maybe install the latest from alpine edge) or build libqpdf as described here. However, you will need to take some special steps not covered there, such as upgrading libressl or gnutls.
https://pikepdf.readthedocs.io/en/latest/installation.html#building-against-a-qpdf-source-tree

@stumpylog
Copy link
Contributor

pypa/manylinux#1505 might help, but I don't think it quite be enough to fix building directly, since the change to require 11.5.0, which isn't in many package repositories yet (only edge for Alpine at the moment).

But maybe with a change to a newer alpine, it will be easier to setup a working build environment with the before-all commands?

@jbarlow83
Copy link
Member

I will try again when musllinux1-2 is released.

Using Alpine edge in before-all should be possible. I think that edge is currently too far ahead of the base musl image and there are too many complex Alpine-specific problems to resolve related to selection of encryption libraries.

@stumpylog
Copy link
Contributor

Looks like cibuildwheel 2.15.0 is released and includes the musl_1_2 support

@jbarlow83
Copy link
Member

@stumpylog Thanks for the notice. I was pleasantly surprised that musl_1_2 built and passed tests with relatively little pain in a quick local test, so I wired it up for a full build, and without much fuss, got Python 3.9-3.12 musl wheels to build. I'll be able to release musl wheels soon.

@jbarlow83
Copy link
Member

Fixed in v8.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants