Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python : Import cairo error (2.7 & 3.6) undefined symbol: cairo_tee_surface_index

I get the following error when trying to import gtk in Python 2.7 :

>>> import gtk Traceback (most recent call last): File "<stdin>", line 1, in <module> File "gtk/__init__.py", line 40, in <module> from gtk import _gtk File "/usr/lib/python2.7/site-packages/cairo/__init__.py", line 1, in <module> from ._cairo import * # noqa: F401,F403 ImportError: /usr/lib/python2.7/site-packages/cairo/_cairo.so: undefined symbol: cairo_tee_surface_index

And I get the following error when trying to import cairo from Python 3.6:

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

I compiled and built the modules in the order as given in the BLFS book. I also installed cairo as given in the book with tee enabled.

My system is an LFS, with 4.14.4 Kernel Version, with Python 2.7.14 and Python 3.6.4.

EDIT: Downloaded the source and did 'make uninstall' and then reinstalled it. Now I can import cairo without any errors.

like image 273
rmn Avatar asked Jan 01 '18 11:01

rmn


1 Answers

conda install -c conda-forge pycairo

Just install your pycairo using this command, it will work fine and run fine. No need to do anything.

like image 150
Swain Subrat Kumar Avatar answered Oct 22 '22 23:10

Swain Subrat Kumar