# Problem installing Cairo library

**URL:** <https://igraph.discourse.group/t/problem-installing-cairo-library/156>\
**Category:** Installation\
**Tags:** Python\
**Created:** [26 March 2020 11:50 UTC](https://igraph.discourse.group/t/problem-installing-cairo-library/156 "2020-03-26T11:50:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Onnis](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/marco_onnis/32/162_2.png) [@Marco\_Onnis](https://igraph.discourse.group/u/Marco_Onnis)\
**Post date:** [26 March 2020 11:50 UTC](https://igraph.discourse.group/t/problem-installing-cairo-library/156/1 "2020-03-26T11:50:55Z")

</div>

Hello guys, I’m having a lot of troubles trying to use igraph.  
Whatever I do or write, when I run the code, it generates always this message:

> C:\Users\Marco\PycharmProjects\ortuproject\venv\Scripts\python.exe “C:/Users/Marco/PycharmProjects/ortuproject/Teoria Dei Grafi\_script con NetworkX.py”  
> Traceback (most recent call last):  
> File “C:/Users/Marco/PycharmProjects/ortuproject/Teoria Dei Grafi\_script con NetworkX.py”, line 1, in   
> from igraph import \*  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\__init_\_.py”, line 35, in   
> from igraph.clustering import \*  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\clustering.py”, line 36, in   
> from igraph.drawing.colors import ClusterColoringPalette  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\drawing\__init_\_.py”, line 30, in   
> from igraph.drawing.graph import DefaultGraphDrawer  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\drawing\graph.py”, line 27, in   
> from igraph.drawing.edge import ArrowEdgeDrawer  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\drawing\edge.py”, line 17, in   
> cairo = find\_cairo()  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\igraph\drawing\utils.py”, line 413, in find\_cairo  
> module = **import** (module\_name)  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\cairocffi\__init_\_.py”, line 50, in   
> (‘libcairo.so’, ‘libcairo.2.dylib’, ‘libcairo-2.dll’))  
> File “C:\Users\Marco\PycharmProjects\ortuproject\venv\lib\site-packages\cairocffi\__init_\_.py”, line 45, in dlopen  
> raise OSError(error\_message) # pragma: no cover  
> OSError: no library called “cairo” was found  
> no library called “libcairo-2” was found  
> cannot load library ‘libcairo.so’: error 0x7e  
> cannot load library ‘libcairo.2.dylib’: error 0x7e  
> cannot load library ‘libcairo-2.dll’: error 0x7e

a guy told me to install Cairo from the site _cairographics / download_

but I’m a noob and I don’t understand he instructions. I tried to follow this one:

_From Dominic Lachowicz:_

_Since GTK+ 2.8 and newer depends on Cairo, you can have Cairo installed on Win32 as a side-effect of installing GTK+. For example, see [The Glade/GTK+ for Windows Toolkit](gladewin32 sourceforge)._

but what shoul Ido with GTK? trying pip install gtk? or install some stuff from [this](http://gladewin32.sourceforge.net/) page?

also gtk site at the download page gives the 404 error.

I apologise if I committed some formal error writing, this is my first question but I need to learn igraph for a thesis project and I’m afraid that alone i would be stuck.

thanks!

---

<div class="post-metadata">

**Author:** ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)\
**Post date:** [26 March 2020 15:46 UTC](https://igraph.discourse.group/t/problem-installing-cairo-library/156/2 "2020-03-26T15:46:42Z")

</div>

On Windows it would be most convenient to simply install the `python-igraph` library through [Anaconda](https://anaconda.org/conda-forge/python-igraph). That way, all necessary libraries are installed for you, including the `pycairo` python library and the necessary `cairo` library.

---

<div class="post-metadata">

**Author:** ![tamas](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/tamas/32/1261_2.png) [@tamas](https://igraph.discourse.group/u/tamas)\
**Post date:** [26 March 2020 17:30 UTC](https://igraph.discourse.group/t/problem-installing-cairo-library/156/3 "2020-03-26T17:30:12Z")

</div>

Some further info: it looks like you have `cairocffi` on your machine. `cairocffi` is a Python binding to the Cairo library, but it needs Cairo itself to work correctly. There are three paths ahead that you can take. The easiest is probably the one suggested by @vtraag: just install `python-igraph` from Anaconda Python and you’ll get all the dependencies, pre-compiled and nicely wrapped up. If you insist on using the “normal” Python on Windows, you either need to install the Cairo library itself so `cairocffi` can find it without blowing up, or you need to _uninstall_ `cairocffi` and accept the limitation that you won’t be able to plot graphs from igraph. (But otherwise it would work just fine, the plotting related parts of the library would be disabled).
