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

Cario install problem -- undefined symbol: cairo_svg_surface_set_document_unit #148

Closed
Moribund7 opened this issue May 8, 2019 · 16 comments

Comments

@Moribund7
Copy link

Hi,
I have problem with installing pycairo. I try follow instruction https://pycairo.readthedocs.io/en/latest/getting_started.html
but while trying import cairo i get this message:

Python 3.7.2 (default, Dec 29 2018, 06:19:36)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import cairo
Traceback (most recent call last):
File "", line 1, in
File "/home/filip/anaconda3/lib/python3.7/site-packages/cairo/init.py", line 1, in
from ._cairo import * # noqa: F401,F403
ImportError: /home/filip/anaconda3/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit

Installation end without any error.

Thanks for any help,
Filip

@lazka
Copy link
Member

lazka commented May 8, 2019

You somehow have an older cairo version now compared to when you build pycairo.

@Moribund7
Copy link
Author

I try uninstall pycairo and cairo and install it again, but still get the same error.

@lazka
Copy link
Member

lazka commented May 8, 2019

you have to pass --no-cache-dir to pip install otherwise it will just install it again as is.

@lazka
Copy link
Member

lazka commented Jun 15, 2019

I don't know any way to tell pip to not cache build results and re-use them in a different environment. So not much we can do here -> closing.

@shivam1423
Copy link

Hi I'm also facing the similar issue.

import cairo
Traceback (most recent call last):
File "", line 1, in
File "/home/shivam/anaconda3/lib/python3.7/site-packages/cairo/init.py", line 1, in
from ._cairo import * # noqa: F401,F403
ImportError: /home/shivam/anaconda3/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit

I working on ubantu with pycairo-1.19.1
Is there any other solution?

@jeisner
Copy link

jeisner commented Aug 22, 2020

I am getting the same error. This is a new Linux laptop with fresh installs of everything including anaconda.
Not clear to me what I have to do to get Cairo installed.
I'm not super-familiar with the Python ecosystem, but am trying to install a script that uses other things that use Cairo ... and seem to have run into a dead end here.

@jeisner
Copy link

jeisner commented Aug 22, 2020

Here is a workaround posted elsewhere:
https://www.reddit.com/r/Python/comments/doq8ye/installing_pycairo_issue/

@Jwolter0
Copy link

Here is a workaround posted elsewhere:
https://www.reddit.com/r/Python/comments/doq8ye/installing_pycairo_issue/

Same problem, and that worked for me.

TL;DR: try

pip3 install pycairo==1.11.1

@TianyiShi2001
Copy link

TL;DR: try

pip3 install pycairo==1.11.1

This works but doesn't really solve the problem. A newer version should be expected to be back-compatible.

@naveen521kk
Copy link
Contributor

Try

pip install pycairo --no-cache --force --no-binary :all:

@tamhanepd
Copy link

Try

pip install pycairo --no-cache --force --no-binary :all:

It worked for me. PyGObject wasn't getting installed despite having Cairo. Using this command and replacing pycairo with pygobject worked.

@americapat
Copy link

unresolved for me:
$ pip3 install PyGObject --no-cache --force --no-binary :all:
Collecting PyGObject
Downloading PyGObject-3.42.0.tar.gz (716 kB)
...
Successfully built pycairo
Failed to build PyGObject
ImportError: /tmp/pip-build-env-0m6jvsct/overlay/lib/python3.7/site-packages/cairo/_cairo.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cairo_svg_surface_set_document_unit
Much appreciated if someone can figure this one, happy to provide more info. -- Pat.

@Neltherion
Copy link

@americapat I have the same problem as you. Did you find any solutions?

@Hubert-YH
Copy link

same problems, I tried all the suggestions yet still failed

@Hubert-YH
Copy link

TL;DR: try
pip3 install pycairo==1.11.1

This works but doesn't really solve the problem. A newer version should be expected to be back-compatible.

I think I have got a possible answer, at least for me, some functions should be achieved both with Cairo and pyoject, yet the least version requires a version newer than 1.16 but perhaps the newest version of Cairo did not match PyObject well, and it might already abandon symbols like cairo_tee_surface_index, but some old software is still using it. ideally, all these stuff should be arranged simultaneously, but it turns out to be different in the reality

@Hubert-YH
Copy link

In my practice, it is from Cairo-1.14.0, that cairo_svg_surface_set_document_unit was deleted
from changelog we can see:
1.14.0 - 2017-07-12
General:
Requires at least cairo 1.13.1 (The snapshop in Ubuntu 14.04)

Tests:
Optional Hypothesis tests.

New Features:
Add Surface.set_device_scale() and Surface.get_device_scale(). #pr-44 (Sander Sweers)

Add Device #pr-45

Add Surface.get_device() #pr-45

Add ScriptDevice and ScriptMode #pr-46

Add ScriptSurface #17

Add Status.JBIG2_GLOBAL_MISSING

Add Format.stride_for_width()

Add TextClusterFlags and SurfaceObserverMode

Add Gradient.get_color_stops_rgba()

Add TeeSurface !! here !!
Add MeshPattern

Add TeeSurface !! here must be related to cairo_tee_surface_index or other cairo tee stuffs

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