pycairo icon indicating copy to clipboard operation
pycairo copied to clipboard

Able to use pycairo 1.11.1 but not 1.20.0

Open TianyiShi2001 opened this issue 4 years ago • 2 comments

My system is Manjaro Linux 20.2, my Python version is 3.8.5, and I was experiencing the same problem as described in https://github.com/pygobject/pycairo/issues/148 , i.e., when trying to import cairo, I experience the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tianyi/anaconda3/lib/python3.8/site-packages/cairo/__init__.py", line 1, in <module>
    from ._cairo import *  # noqa: F401,F403
ImportError: /home/tianyi/anaconda3/lib/python3.8/site-packages/cairo/_cairo.cpython-38-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit

I tried pip3 install pycairo==1.11.1 and this solves the problem. Probably some changes in later versions made pycairo not back-compatible?

TianyiShi2001 avatar Jan 16 '21 00:01 TianyiShi2001

My system is Manjaro Linux 20.2, my Python version is 3.8.5, and I was experiencing the same problem as described in #148 , i.e., when trying to import cairo, I experience the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tianyi/anaconda3/lib/python3.8/site-packages/cairo/__init__.py", line 1, in <module>
    from ._cairo import *  # noqa: F401,F403
ImportError: /home/tianyi/anaconda3/lib/python3.8/site-packages/cairo/_cairo.cpython-38-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit

I tried pip3 install pycairo==1.11.1 and this solves the problem. Probably some changes in later versions made pycairo not back-compatible?

I had hard time using libcairo2-dev and pycairo in Ubuntu 18.04 LTS system. Tried all the options. But had "File "/usr/lib/python3/dist-packages/cairo/init.py", line 1, in from ._cairo import * # noqa: F401,F403 ModuleNotFoundError: No module named 'cairo._cairo' " problem. However I used $ python3.7 -m pip install pycairo==1.11.1 This has resolved the issue.Some issue is there in the current version of pycairo2-dev. Please look into it and resolve. Thanks

rajatdash avatar Jan 22 '21 10:01 rajatdash

Also I will give credit to https://www.reddit.com/r/Python/comments/doq8ye/installing_pycairo_issue/ 2.https://github.com/3b1b/manim/pull/571/commits/36a7d9fb1825554a460c6fd55389e90cc128b4bf;

Change your requirements.txt with the correct version. It should work with even pycairo==1.17.1 image

rajatdash avatar Jan 22 '21 10:01 rajatdash