Simd
Simd

Reputation: 21233

python + igraph "plotting not available"

I installed python-igraph 0.5.4 and igraph 0.5.4 (also tested 0.6) from source on a RHEL machine. All is fine except when I try to plot I get.

"TypeError: plotting not available"

There were no errors or warnings in the configure or install stages.

What do I need to install on linux to get plotting to work? I don't have root so will need to install it from source.

Upvotes: 29

Views: 24872

Answers (5)

Bálint Sass
Bálint Sass

Reputation: 551

A solution for Ubuntu which worked for me. Just install Cairo:

sudo apt install libcairo2-dev

From: https://www.cairographics.org/download

Upvotes: 0

Unis
Unis

Reputation: 824

As pointed out already by several respondents, pycairo is likely required in this case. Installation of pycairo using Conda fixed the issue on my machine within less than a minute:

conda install -c conda-forge pycairo

I assume that the same result can be achieved using PIP:

pip install pycairo

Upvotes: 2

Alexander Rakhmaev
Alexander Rakhmaev

Reputation: 1055

I had the same problem (Windows). You have to install Cairo.

Unfortunately, there is no official assembly for windows. But there are unofficial ones.

Notes:

  • cpXX means version of python (check: python -V)
  • execute in the folder with the file: pip install *.whl (versio of pip must be higher than 19)

See the official installation tutorial for more details (chpter igraph on Windows).

Upvotes: 2

seralouk
seralouk

Reputation: 33147

I had the same problem on my MacBook so I wanted to share my solution.

I tried to install pycairo, py2cairo. The installation seemed to be okay but then:

  1. I could not import pycairo
  2. igraph's plot would not work.

The following solved the igraph plotting issue:

sudo pip install cairocffi

or just

pip install cairocffi

So instead of pycairo I used cairocffi and this did the trick.

Upvotes: 17

Tamás
Tamás

Reputation: 48061

igraph uses the Cairo library for plotting, so you will need Cairo and its Python interface. Chances are that Cairo is already installed on your machine (look for files named libcairo* in /usr/lib and /usr/lib64), so you just need the Python interface of Cairo.

There is one catch, though. In order to compile the Python interface of Cairo, you will need Cairo's header files, which might or might not be present on your system. If they are not installed, you can download Cairo's source and get the include files from there.

Upvotes: 13

Related Questions