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

Cairocffi not building with XCB support in 1.5.0 #212

Closed
elParaguayo opened this issue Mar 24, 2023 · 15 comments · Fixed by #216
Closed

Cairocffi not building with XCB support in 1.5.0 #212

elParaguayo opened this issue Mar 24, 2023 · 15 comments · Fixed by #216

Comments

@elParaguayo
Copy link

I'm one of the qtile developers and I've noticed that our github actions and docs are both failing since the release of 1.5.0.

At first, I thought this was an issue due to both those build environments using Ubuntu 20.04 but switching to 22.04 doesn't change anything. I've also just tried on my laptop and it also fails.

Steps to reproduce:

  • Create a clean virtual environment
  • pip install xcffib
  • pip install --upgrade --no-cache cairocffi

Start a python terminal:

>>> from cairocffi import cairo
>>> cairo.cairo_xcb_surface_create

This will generate the following error:

AttributeError: cffi library 'libcairo.so.2' has no function, constant or global variable named 'cairo_xcb_surface_create'. Did you mean: 'cairo_pdf_surface_create'?

I can get it to build ok with 1.4.0 so something's stopping it working in 1.5.0.

Happy to help debug this so let me know if there's more information needed.

@liZe
Copy link
Member

liZe commented Mar 24, 2023

Thanks for the bug report, and sorry for that. The problem comes from the isolation during the build of the wheel. A dirty workaround is to use:

pip install xcffib wheel
pip install --no-cache --upgrade --no-build-isolation cairocffi

There’s probably a setup option in setuptools to install xcffib before the build, only when the [xcb] option is set.

@elParaguayo
Copy link
Author

elParaguayo commented Mar 25, 2023

Thanks for the quick reply. I'll test later today and report back.

I'd also be happy to do a PR to update your docs for this.

@liZe
Copy link
Member

liZe commented Mar 25, 2023

I'd also be happy to do a PR to update your docs for this.

Thanks for your help. I’m sure we can find a proper way to handle this in the code.

@elParaguayo
Copy link
Author

OK - I'll hold off PR for now but I can confirm the commands in your first reply work for me locally so I'm pretty confident they'll work on our builds once I've updated them.

Thanks for the assistance - greatly appreciated.

@liZe
Copy link
Member

liZe commented Mar 25, 2023

We can keep this issue open until a new package is released.

@liZe liZe reopened this Mar 25, 2023
@liZe
Copy link
Member

liZe commented Mar 25, 2023

A question has been open: pypa/setuptools#3873

@liZe
Copy link
Member

liZe commented Apr 15, 2023

Version 1.5.1 has been released, tests are welcome!

@Malex
Copy link

Malex commented May 17, 2023

It was still broken for me when installing qtile (environments: Funtoo and Gentoo, python3.10, etc)

I could resolve it by manually running this command:
pip install --no-build-isolation --no-cache --upgrade --ignore-installed cairocffi[xcb]

@liZe
Copy link
Member

liZe commented May 18, 2023

@Malex Hi!

It doesn’t work anymore for me too. I don’t know why.

During the wheel generation, Setuptools complains that it doesn’t find pip:

Traceback (most recent call last):
  File "/home/lize/venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

Even if I add pip as a build dependency, it doesn’t work because the building script doesn’t find the freshly installed xcffib package (the error is silenced by this try, but it doesn’t work).

I don’t know what to do, I’ve already spent days trying to fix this.

@Malex
Copy link

Malex commented May 26, 2023

Trying to understand why 1.4 worked but 1.5 did not, I took a look at the diffs and there are a few changes that could have impacted
v1.4.0...v1.5.1
I noticed there is a switch from setup.cfg to pyproject.toml and other related changes.
A "solution" could just be to revert this

@liZe
Copy link
Member

liZe commented May 26, 2023

A "solution" could just be to revert this

I’d like to avoid that, in order to have a future-proof packaging system that follows PEP-517 and PEP-518, but if it’s the only way to get this working, maybe that’s the only solution…

@liZe
Copy link
Member

liZe commented May 29, 2023

Let’s fix this instead: https://foss.heptapod.net/pypy/cffi/-/issues/441

Anyone interested?

@fgplastina
Copy link

i'm getting this error. Tried everything in this thread but didn't work :/

@liZe
Copy link
Member

liZe commented May 31, 2023

i'm getting this error. Tried everything in this thread but didn't work :/

You can install version 1.4.0 of CairoCFFI.

@fgplastina
Copy link

fgplastina commented May 31, 2023

@liZe you are right!

I tried that in the first instance and it didn't work, I just needed to add those arguments to the pip command and specify version 1.4.0. Thanks for your answer!

@liZe liZe reopened this Jun 1, 2023
liZe added a commit that referenced this issue Jun 1, 2023
@liZe liZe closed this as completed in #216 Jun 12, 2023
netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Apr 30, 2024
Version 1.7.0
.............

Released on 2024-04-27

* Drop Python 3.7 support, add Python 3.12 support
* `#221 <https://github.com/Kozea/cairocffi/pull/225>`_:
  Add environment variable to set folder where DLLs are installed on Windows
* `#225 <https://github.com/Kozea/cairocffi/pull/225>`_:
  Use Ruff instead of Flake8 and isort


Version 1.6.1
.............

Released on 2023-07-24

* `#217 <https://github.com/Kozea/cairocffi/issues/217>`_:
  Repair installation with PyInstaller


Version 1.6.0
.............

Released on 2023-06-12

**This version uses a new CFFI mode that may break your program.**

CairoCFFI now uses Flit for packaging and is also distributed as a Python
wheel.

Please test carefully and don’t hesitate to report issues before using it in
production.

* `#216 <https://github.com/Kozea/cairocffi/pull/216>`_:
  Use ABI-level in-line CFFI mode


Version 1.5.1
.............

Released on 2023-04-15

* `#212 <https://github.com/Kozea/cairocffi/issues/212>`_:
  Bring back XCB support during wheel generation


Version 1.5.0
.............

Released on 2023-03-17

* `#106 <https://github.com/Kozea/cairocffi/issues/106>`_,
  `#200 <https://github.com/Kozea/cairocffi/issues/200>`_:
  Fallback to manual PNG file creation on hardened systems
* `#210 <https://github.com/Kozea/cairocffi/pull/210>`_:
  Use pyproject.toml for packaging and remove other useless files


Version 1.4.0
.............

Released on 2022-09-23

* `#205 <https://github.com/Kozea/cairocffi/pull/205>`_:
  Use pikepdf to parse generated PDF
* `#171 <https://github.com/Kozea/cairocffi/pull/171>`_:
  Don’t use deprecated pytest-runner anymore


Version 1.3.0
.............

Released on 2021-10-04

* `2cd512d <https://github.com/Kozea/cairocffi/commit/2cd512d>`_:
  Drop Python 3.6 support
* `#196 <https://github.com/Kozea/cairocffi/pull/196>`_:
  Fix import `constants.py` import
* `#169 <https://github.com/Kozea/cairocffi/pull/169>`_:
  Add extra library name "cairo-2.dll"
* `#178 <https://github.com/Kozea/cairocffi/pull/178>`_:
  Workaround for testing date string with cairo 1.17.4
* `#186 <https://github.com/Kozea/cairocffi/pull/186>`_:
  Fix link in documentation
* `#195 <https://github.com/Kozea/cairocffi/pull/195>`_:
  Fix typo in documentation
* `#184 <https://github.com/Kozea/cairocffi/pull/184>`_,
  `a4fc2a7 <https://github.com/Kozea/cairocffi/commit/a4fc2a7>`_:
  Clean .gitignore


Version 1.2.0
.............

Released on 2020-10-29

* `#152 <https://github.com/Kozea/cairocffi/pull/152>`_:
  Add NumPy support
* `#143 <https://github.com/Kozea/cairocffi/issues/143>`_:
  Make write_to_png function work on hardened systems
* `#156 <https://github.com/Kozea/cairocffi/pull/156>`_:
  Use major version name to open shared libraries
* `#165 <https://github.com/Kozea/cairocffi/pull/165>`_:
  Don’t list setuptools as required for installation


Version 1.1.0
.............

Released on 2019-09-05

* `#135 <https://github.com/Kozea/cairocffi/pull/135>`_,
  `#127 <https://github.com/Kozea/cairocffi/pull/127>`_,
  `#119 <https://github.com/Kozea/cairocffi/pull/119>`_:
  Clean the way external libraries are found
* `#126 <https://github.com/Kozea/cairocffi/pull/126>`_:
  Remove const char* elements from cdef
* Support Cairo features up to 1.17.2
* Fix documentation generation


Version 1.0.2
.............

Released on 2019-02-15

* `#123 <https://github.com/Kozea/cairocffi/issues/123>`_:
  Rely on a recent version of setuptools to handle VERSION


Version 1.0.1
.............

Released on 2019-02-12

* `#120 <https://github.com/Kozea/cairocffi/issues/120>`_:
  Don't delete _generated modules on ffi_build import


Version 1.0.0
.............

Released on 2019-02-08

6 years after its first release, cairocffi can now be considered as stable.

* Drop Python 2.6, 2.7 and 3.4 support
* Test with Python 3.7
* Clean code, tests and packaging
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

Successfully merging a pull request may close this issue.

4 participants