[igraph] plotting problem with python

930 views
Skip to first unread message

Glenn Fulford

unread,
Oct 3, 2010, 11:36:07 PM10/3/10
to igrap...@nongnu.org

Hi, I have just installed igraph and I am having a problem with plotting.

I have followed the instructions on the documentation site
http://www.cs.rhul.ac.uk/home/tamas/development/igraph/tutorial/install.html#graph-plotting-in-igraph-on-windows

which includes installing pycairo, and putting the required dll files into Python2.6\Lib\site-packages\cairo

igraph itself has installed properly, as running
>>> import igraph.test
>>> igraph.test.test()
gives no errors, and all tests work.

However, when I try to run
from igraph import *
g = Graph.Famous("petersen")
summary(g)
plot(g)

I get the following error:

Traceback (most recent call last):
File "C:\Documents and Settings\fulford\Desktop\netstuff\test1.py", line 4, in <module>
plot(g)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 762, in plot
result = Plot(target, bbox)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 222, in __init__
self._surface_was_created=not isinstance(target, cairo.Surface)
File "C:\Python26\lib\site-packages\igraph\drawing.py", line 51, in __getattr__
raise TypeError, "plotting not available"
TypeError: plotting not available

I also tried the following:
import cairo

but got the error:

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import cairo
File "C:\Python26\lib\site-packages\cairo\__init__.py", line 1, in <module>
from _cairo import *
ImportError: DLL load failed: The specified module could not be found.

I am fairly new to python, so am wondering if there is something else I needed to do, like add something to my path variable so that the dll files are found?

Any help or suggestions anyone can give me would be much appreciated, sicve I would very much like to use this software. .
Thanks Glenn.

PS platform details:

Platform: Windows XP
Python version 2.6 (32 bitr) (enthought python distribution 6.2)


Dr Glenn Fulford +61 7 313 85196 QUT Mathematical Sciences,
GPO Box 2343 Brisbane, Qld AUSTRALIA 4001. Cricos no. 00213J
email: g.fu...@qut.edu.au;
_______________________________________________
igraph-help mailing list
igrap...@nongnu.org
http://lists.nongnu.org/mailman/listinfo/igraph-help

Tamas Nepusz

unread,
Oct 4, 2010, 6:39:27 AM10/4/10
to Help for igraph users
Dear Glenn,

It seems like the Python bindings of Cairo are not installed properly on
your machine -- igraph simply reports this when it says "plotting not
available".

I checked a working installation on Windows XP (32-bit) and the
following files should be present in
c:\python26\lib\site-packages\cairo:

__init__.py
_cairo.pyd
libcairo-2.dll
libexpat-1.dll
libfontconfig-1.dll
libpng14-14.dll
zlib1.dll

The error message you see means that Python finds __init__.py in the
cairo subfolder successfully, and it tries to import _cairo.pyd from
there. (.pyd files are like ordinary .dll files, Python just uses a
different extension to distinguish them from .dlls). Unfortunately the
import can fail for at least two reasons:

1) _cairo.pyd itself is missing
2) _cairo.pyd is there, but one of its dependencies is missing.

Unfortunately, the error message is the same in both cases. So, I'd do
the following:

1. Check whether all the files I mentioned above are in the
site-packages\cairo folder. If not, install them.

2. If they are all there, download Dependency Walker from
www.dependencywalker.com and open _cairo.pyd with it. Dependency Walker
should recursively traverse the dependency tree of _cairo.pyd and report
any other DLLs that you are missing.

--
Tamas

Glenn Fulford

unread,
Oct 5, 2010, 1:50:08 AM10/5/10
to Help for igraph users
Dear Tamas,
thanks very much for your suggestions. I beleive I eventiually tracked down the problem.

I found the following web page very useful.
http://alex.matan.ca/install-cairo-wxpyton-pycairo-python-windows

First thing it told me was to append c:\Python26\Lib\site-packages\cairo to my path, which I hadn't done, but this didn't fix the problem.

I then reinstalled the dll files, this time from the wxpythion site. Thiat seemed to fix the problem. So not surre exactly which dll it was, but I can compare themn if anyone is interested.

Glenn

Dr Glenn Fulford +61 7 313 85196 QUT Mathematical Sciences,
GPO Box 2343 Brisbane, Qld AUSTRALIA 4001. Cricos no. 00213J

email: g.fu...@qut.edu.au; glenn....@gmail.com
calender: http://www.google.com/calendar/embed?src=glenn.fulford%40gmail.com&ctz=Australia/Brisbane&mode=WEEK
skype: glenn.fulford msgr chat: glenn.q...@hotmail.com
________________________________________
From: igraph-help-bounces+g.fulford=qut.e...@nongnu.org [igraph-help-bounces+g.fulford=qut.e...@nongnu.org] On Behalf Of Tamas Nepusz [nta...@gmail.com]
Sent: Monday, 4 October 2010 8:39 PM
To: Help for igraph users
Subject: Re: [igraph] plotting problem with python

Reply all
Reply to author
Forward
0 new messages