cElementTree dependency breaks PyPy usage

30 views
Skip to first unread message

Adam Faulconbridge

unread,
May 10, 2011, 8:31:36 AM5/10/11
to networkx...@googlegroups.com
PyPy aims to speed up Python programs, but doesnt work with NetworkX due to dependancy on the C implementation of element tree. This can easily be fixed:

In networkx/readwrite/gexf.py line 29

from xml.etree.cElementTree import ElementTree, Element, tostring

should be replaced with

try:
    from xml.etree.cElementTree import ElementTree, Element, tostring
except ImportError:
    from xml.etree.ElementTree import ElementTree, Element, tostring

I've tried raising a trac ticket for this, but the system doesnt work for me.

Aric Hagberg

unread,
May 10, 2011, 9:22:57 AM5/10/11
to networkx...@googlegroups.com

It did work Anonymous tickets are moderated, see
https://networkx.lanl.gov/trac/ticket/549
And please feel free to test to make sure that fix is correct.

Aric

Chris Wj

unread,
May 12, 2011, 2:30:24 PM5/12/11
to networkx...@googlegroups.com
Have you (anyone) tried pypy with NetworkX recently? Is there a good speed up? Are there parts that don't work besides the one identified here?


--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To post to this group, send email to networkx...@googlegroups.com.
To unsubscribe from this group, send email to networkx-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/networkx-discuss?hl=en.


Aric Hagberg

unread,
May 12, 2011, 2:58:43 PM5/12/11
to networkx...@googlegroups.com
On Thu, May 12, 2011 at 12:30 PM, Chris Wj <chri...@gmail.com> wrote:
> Have you (anyone) tried pypy with NetworkX recently? Is there a good speed
> up? Are there parts that don't work besides the one identified here?

I just tried to run the tests and there are some failures (including
some that crash/hang the interpreter).
But most of NetworkX (including the base classes) works fine.

There are some benchmarks in
http://networkx.lanl.gov/svn/networkx/trunk/networkx/tests/benchmark.py
that we could try to see about performance.

Can you help make NetworkX work with pypy?

Aric

Chris Wj

unread,
May 12, 2011, 3:08:16 PM5/12/11
to networkx...@googlegroups.com
I think making NetworkX work with pypy would be a great project to hack on. I will look to spend some time doing so as soon as I finish my current project and the semester ends (Monday)! I used NetworkX in a diffusion network graph reproduction for my project; http://diffusionsim.sf.net if anyone is interested :).


Aric

Reply all
Reply to author
Forward
0 new messages