question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named 'cairocffi._generated'

See original GitHub issue

Not working on a project using PDM running on WSL2, Ubuntu 20.04. I’ve inspected the code and it seems that this module actually doesn’t exist.

❯ pdm run start
Traceback (most recent call last):
  (...)
    from . import computed_values, counters, media_queries
  File "/home/my-project/__pypackages__/3.9/lib/weasyprint/css/computed_values.py", line 15, in <module>
    from .. import text
  File "/home/my-project/__pypackages__/3.9/lib/weasyprint/text.py", line 11, in <module>
    import cairocffi as cairo
  File "/home/my-project/__pypackages__/3.9/lib/cairocffi/__init__.py", line 17, in <module>
    from ._generated.ffi import ffi
ModuleNotFoundError: No module named 'cairocffi._generated'

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
liZecommented, Apr 11, 2022

What you can do is:

  • remove CairoCFFI’s wheel that’s been created in ~/.cache/pdm/wheels
  • pdm init
  • pdm add cairocffi -v

In the logs, you should have something like

[…]
Building wheel for https://files.pythonhosted.org/packages/8b/d2/137b346d64f0d6428a90f60b51a06706592a86b74fd21ff66c853537cb9b/cairocffi-1.3.0.tar.gz#sha256=108a3a7cb09e203bdd8501d9baad91d786d204561bd71e9364e8b34897c47b91 (from https://pypi.org/simple/cairocffi/) (requires-python:>=3.7)
Collecting wheel
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=40.8.0
  Using cached setuptools-62.1.0-py3-none-any.whl (1.1 MB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-62.1.0 wheel-0.37.1
[…]
creating build
creating build/lib
creating build/lib/cairocffi
copying cairocffi/xcb.py -> build/lib/cairocffi
copying cairocffi/test_xcb.py -> build/lib/cairocffi
copying cairocffi/test_pixbuf.py -> build/lib/cairocffi
copying cairocffi/test_numpy.py -> build/lib/cairocffi
copying cairocffi/test_cairo.py -> build/lib/cairocffi
copying cairocffi/surfaces.py -> build/lib/cairocffi
copying cairocffi/pixbuf.py -> build/lib/cairocffi
copying cairocffi/patterns.py -> build/lib/cairocffi
copying cairocffi/matrix.py -> build/lib/cairocffi
copying cairocffi/fonts.py -> build/lib/cairocffi
copying cairocffi/ffi_build.py -> build/lib/cairocffi
copying cairocffi/context.py -> build/lib/cairocffi
copying cairocffi/constants.py -> build/lib/cairocffi
copying cairocffi/__init__.py -> build/lib/cairocffi
copying cairocffi/VERSION -> build/lib/cairocffi
file cairocffi/_generated/ffi.py (for module cairocffi._generated.ffi) not found
file cairocffi/_generated/ffi_pixbuf.py (for module cairocffi._generated.ffi_pixbuf) not found
generating cffi module 'build/lib/cairocffi/_generated/ffi.py'
creating build/lib/cairocffi/_generated
generating cffi module 'build/lib/cairocffi/_generated/ffi_pixbuf.py'
[…]

If you don’t, maybe you have an old version of setuptools and should update it.

0reactions
carloseustaquiocommented, Apr 11, 2022

Oh… That fixed the issue! Thank you very much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named 'cairocffi' - Stack Overflow
Save this question. Show activity on this post. I am trying to run a sample code provided by scikit-rf (https://scikit-rf-web.readthedocs.io/) ...
Read more >
ImportError: No module named 'cairocffi' · Issue #29 - GitHub
Hello, I need to install cairocffi in order to use some example files from scikit-rf. However even though I used pip install cairocffi, ......
Read more >
cairocffi - PyPI
cairocffi is a CFFI-based drop-in replacement for Pycairo, a set of Python bindings and object-oriented API for cairo. Cairo is a 2D vector...
Read more >
GitHub Stats — Matplotlib 2.2.2 documentation
These lists are automatically generated, and may be incomplete or contain ... #9344: ImportError: No module named functools_lru_cache ...
Read more >
Python API reference — cairocffi 1.4.0 documentation
This will generate a surface that may be queried and used as a source, without generating a temporary file. The PostScript surface backend...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found