pygobject / pycairo

Python bindings for cairo
https://pycairo.readthedocs.io
Other
622 stars 85 forks source link

problem with reportlab version 4.0.0 #320

Open sidnou opened 1 year ago

sidnou commented 1 year ago

`Building wheel for pycairo (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pycairo (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [12 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-cpython-310 creating build/lib.linux-x86_64-cpython-310/cairo copying cairo/init.py -> build/lib.linux-x86_64-cpython-310/cairo copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-310/cairo copying cairo/py.typed -> build/lib.linux-x86_64-cpython-310/cairo running build_ext 'pkg-config' not found. Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10'] [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycairo Failed to build pycairo ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects```

SteinRobert commented 1 year ago

Had the same error in a docker image build. Adding the following helped:

apt install -y pkg-config

After that cairo was missing. I added the following and everything worked:

 apt install -y libcairo2-dev

Hope it helps.

peterjc commented 1 year ago

I've hit this too, also on macOS, as pycairo is a new dependency in ReportLab v4 (having updated from ReportLab v3.6).

It appears that currently only pre-compiled pycairo wheels for Windows are provided on PyPI, and compiling pycairo from source is non-trivial requiring things like the cairo library development headers.

See also #168 looking at providing manylinux wheels which could work for most Linux computers.

dannielperez commented 1 year ago

Any fixes for these issues? It's been months and pycairo has issues installing in Linux vm's as well.

stuaxo commented 1 year ago

(with help from @naveen521kk's post on the other ticket) pycairo is a binding to cairo and cairo may be built with different flags under different linux distros, this means that you have to have the dev packages and the headers installed.

If we distributed a pycairo whl then this might not be compatible with the cairo installed in the system.

IMO though: pycairo can't be the only library that has this problem - it applies to any library that is distributed by linux distros where they build with different flags (basically older libraries that use bindings), it would be good to try and work to a general solution with python packaging itself.

The TLDR: is that you have to have the dev packages installed, this was standard for python packages back in the day before WHL etc and pycairo comes from this era.