I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
I have a simple example script attached which shows the behavior. If I run with graph-tool 2.2.18, it works without complaint, e.g.:
$ python graph-tool-play2.py graph_tool version 2.2.18 (commit 83bb8a49, Tue Nov 13 00:57:29 2012 +0100) pruning 11 pruning 13 pruning 14 pruning 19 pruning 23 pruning 26 pruning 46 pruning 47 pruning 48 pruning 52 pruning 63 pruning 81 pruning 93 pruning 97 complete
If I run with python-graph-tool 2.2.25, I get a TypeError, e.g.:
$ python graph-tool-play2.py graph_tool version 2.2.25 (commit feec13d9, Mon Sep 2 00:01:39 2013 +0200) pruning 10 pruning 12 pruning 13 pruning 18 pruning 22 pruning 25 pruning 45 pruning 46 pruning 47 pruning 51 pruning 62 pruning 80 pruning 92 pruning 96 Traceback (most recent call last): File "graph-tool-play2.py", line 59, in <module> g.purge_vertices() # MJH this will die in graph-tool 2.2.25 with a TypeError. Works in 2.2.18. File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 1838, in purge_vertices new_g = Graph(self, prune=(True, False, False)) File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 1109, in __init__ vorder.fa = numpy.arange(gv.num_vertices()) File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 561, in <lambda> lambda self, v: self.__get_set_f_array(v, False), File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 556, in __get_set_f_array a[m] = v TypeError: array cannot be safely cast to required type
Why would this fail in 2.2.25? It's entirely possible that I am missing something basic about how to fly graph-tool.
Any clues appreciated!
Cheers,
Mark.
On 09/28/2013 11:54 AM, Mark Howell wrote:
I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
[snip]
Update... I built graph-tool from the 2.2.25 source tarball and ran from that instead of the python-graph-tool 2.2.25-1 Precise deb package, and my test code ran fine.
Wonder if there's some kind of dependency problem in the 2.2.25-1 Precise deb package?
FWIW I couldn't get 2.2.25 to build from source with the standard Precise numpy package based on 1.6.1. I replaced that with numpy I built from their 1.7.1 tarball and then was able to build graph-tool successfully... after 2 hours of CPU time ;-)
Looking at the present python-graph-tool 2.2.25-1 precise package, it depends on python-scipy (but no particular version or range specified) and from there presumably depends indirectly on numpy. Maybe it is willing to install with an older (1.6) numpy but is partially broken with it?
Cheers,
Mark.
On 09/29/2013 12:05 AM, Mark Howell wrote:
On 09/28/2013 11:54 AM, Mark Howell wrote:
I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
[snip]
Update... I built graph-tool from the 2.2.25 source tarball and ran from that instead of the python-graph-tool 2.2.25-1 Precise deb package, and my test code ran fine.
Wonder if there's some kind of dependency problem in the 2.2.25-1 Precise deb package?
FWIW I couldn't get 2.2.25 to build from source with the standard Precise numpy package based on 1.6.1. I replaced that with numpy I built from their 1.7.1 tarball and then was able to build graph-tool successfully... after 2 hours of CPU time ;-)
Looking at the present python-graph-tool 2.2.25-1 precise package, it depends on python-scipy (but no particular version or range specified) and from there presumably depends indirectly on numpy. Maybe it is willing to install with an older (1.6) numpy but is partially broken with it?
This is strange... I definitely was able to build it with numpy 1.6, otherwise how could I have made the packages?
I do see the same problem on precise, but nowhere else. This all does sound like a nasty numpy compatibility thing, but it is not at all clear what is going on. I'll have to take a closer look.
Cheers, Tiago
On 09/29/2013 03:18 AM, Tiago de Paula Peixoto wrote:
On 09/29/2013 12:05 AM, Mark Howell wrote:
On 09/28/2013 11:54 AM, Mark Howell wrote:
I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
[snip]
Update... I built graph-tool from the 2.2.25 source tarball and ran from that instead of the python-graph-tool 2.2.25-1 Precise deb package, and my test code ran fine.
Wonder if there's some kind of dependency problem in the 2.2.25-1 Precise deb package?
FWIW I couldn't get 2.2.25 to build from source with the standard Precise numpy package based on 1.6.1. I replaced that with numpy I built from their 1.7.1 tarball and then was able to build graph-tool successfully... after 2 hours of CPU time ;-)
Looking at the present python-graph-tool 2.2.25-1 precise package, it depends on python-scipy (but no particular version or range specified) and from there presumably depends indirectly on numpy. Maybe it is willing to install with an older (1.6) numpy but is partially broken with it?
This is strange... I definitely was able to build it with numpy 1.6, otherwise how could I have made the packages?
I do see the same problem on precise, but nowhere else. This all does sound like a nasty numpy compatibility thing, but it is not at all clear what is going on. I'll have to take a closer look.
Cheers, Tiago
Thx Tiago. A little more detail might help: when I tried to compile graph-tool 2.2.25 on Precise with the standard numpy 1.6.1 package, it died while building graph_closeness, complaining of undefined NPY_ARRAY_ALIGNED and brethren:
$ make make all-recursive make[1]: Entering directory `/home/markh/Code/graph-tool-2.2.25' Making all in src make[2]: Entering directory `/home/markh/Code/graph-tool-2.2.25/src' Making all in graph make[3]: Entering directory `/home/markh/Code/graph-tool-2.2.25/src/graph' Making all in centrality make[4]: Entering directory `/home/markh/Code/graph-tool-2.2.25/src/graph/centrality' CXX graph_betweenness.lo CXX graph_centrality_bind.lo CXX graph_closeness.lo In file included from graph_closeness.hh:29:0, from graph_closeness.cc:23: ./../numpy_bind.hh: In function 'boost::python::api::object wrap_vector_owned(std::vector<ValueType>&)': ./../numpy_bind.hh:78:34: error: 'NPY_ARRAY_ALIGNED' was not declared in this scope ./../numpy_bind.hh:78:54: error: 'NPY_ARRAY_C_CONTIGUOUS' was not declared in this scope ./../numpy_bind.hh:79:25: error: 'NPY_ARRAY_OWNDATA' was not declared in this scope ./../numpy_bind.hh:79:45: error: 'NPY_ARRAY_WRITEABLE' was not declared in this scope ./../numpy_bind.hh:79:64: error: there are no arguments to 'PyArray_ENABLEFLAGS' that depend on a template parameter, so a declaration of 'PyArray_ENABLEFLAGS' must be available [-fpermissive] ./../numpy_bind.hh:79:64: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) ./../numpy_bind.hh: In function 'boost::python::api::object wrap_vector_not_owned(std::vector<ValueType>&)': ./../numpy_bind.hh:96:33: error: 'NPY_ARRAY_ALIGNED' was not declared in this scope ./../numpy_bind.hh:96:53: error: 'NPY_ARRAY_C_CONTIGUOUS' was not declared in this scope ./../numpy_bind.hh:97:25: error: 'NPY_ARRAY_WRITEABLE' was not declared in this scope ./../numpy_bind.hh:97:44: error: there are no arguments to 'PyArray_ENABLEFLAGS' that depend on a template parameter, so a declaration of 'PyArray_ENABLEFLAGS' must be available [-fpermissive] ./../numpy_bind.hh: In function 'boost::python::api::object wrap_multi_array_owned(boost::multi_array<ValueType, Dim>&)': ./../numpy_bind.hh:116:34: error: 'NPY_ARRAY_ALIGNED' was not declared in this scope ./../numpy_bind.hh:116:54: error: 'NPY_ARRAY_C_CONTIGUOUS' was not declared in this scope ./../numpy_bind.hh:117:25: error: 'NPY_ARRAY_OWNDATA' was not declared in this scope ./../numpy_bind.hh:117:45: error: 'NPY_ARRAY_WRITEABLE' was not declared in this scope ./../numpy_bind.hh:117:64: error: there are no arguments to 'PyArray_ENABLEFLAGS' that depend on a template parameter, so a declaration of 'PyArray_ENABLEFLAGS' must be available [-fpermissive] ./../numpy_bind.hh: In function 'boost::python::api::object wrap_multi_array_not_owned(boost::multi_array<ValueType, Dim>&)': ./../numpy_bind.hh:130:34: error: 'NPY_ARRAY_ALIGNED' was not declared in this scope ./../numpy_bind.hh:130:54: error: 'NPY_ARRAY_C_CONTIGUOUS' was not declared in this scope ./../numpy_bind.hh:131:25: error: 'NPY_ARRAY_WRITEABLE' was not declared in this scope ./../numpy_bind.hh:131:44: error: there are no arguments to 'PyArray_ENABLEFLAGS' that depend on a template parameter, so a declaration of 'PyArray_ENABLEFLAGS' must be available [-fpermissive] ./../numpy_bind.hh: In function 'boost::multi_array_ref<ValueType, dim> get_array(boost::python::api::object)': ./../numpy_bind.hh:173:30: error: 'NPY_ARRAY_C_CONTIGUOUS' was not declared in this scope At global scope: cc1plus: warning: unrecognized command line option "-Wno-unused-local-typedefs" [enabled by default] make[4]: *** [graph_closeness.lo] Error 1 make[4]: Leaving directory `/home/markh/Code/graph-tool-2.2.25/src/graph/centrality' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/markh/Code/graph-tool-2.2.25/src/graph' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/markh/Code/graph-tool-2.2.25/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/markh/Code/graph-tool-2.2.25' make: *** [all] Error 2 $
Perhaps your build machine has a numpy 1.7 installed in /usr/local/lib/python2.7/dist-packages (or elsewhere) in addition to the standard Precise package in usr/lib/python2.7/dist-packages, and your graph-tool ./configure is finding that one to compile against?
Cheers,
Mark.
On 09/29/2013 08:24 AM, Mark Howell wrote:
On 09/29/2013 03:18 AM, Tiago de Paula Peixoto wrote:
On 09/29/2013 12:05 AM, Mark Howell wrote:
On 09/28/2013 11:54 AM, Mark Howell wrote:
I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
[snip]
Perhaps your build machine has a numpy 1.7 installed in /usr/local/lib/python2.7/dist-packages (or elsewhere) in addition to the standard Precise package in usr/lib/python2.7/dist-packages, and your graph-tool ./configure is finding that one to compile against?
Update... building numpy 1.7.1 from source and installing in default (/usr/local/lib) location is enough to get my test code to work with your python-graph-tool 2.2.25-1 deb package for Precise.
I've left the Precise numpy 1.6.1 installed in /usr/lib so as not to wrestle with other deb package dependencies. The py environment finds the /usr/local/lib (1.7.1) one first.
Cheers,
Mark.
Hi,
Please try the new debian / ubuntu packaged for the new version. This issue should be fixed now.
Cheers, Tiago
On 09/30/2013 07:44 PM, Mark Howell wrote:
On 09/29/2013 08:24 AM, Mark Howell wrote:
On 09/29/2013 03:18 AM, Tiago de Paula Peixoto wrote:
On 09/29/2013 12:05 AM, Mark Howell wrote:
On 09/28/2013 11:54 AM, Mark Howell wrote:
I am trying to use purge_vertices() with a vertex filter to efficiently remove vertices from a graph. I am seeing different behavior in version 2.2.18 and 2.2.25, both as prebuilt packages for Ubuntu precise (current "graph-tool" and "python-graph-tool" packages, respectively)
[snip]
Perhaps your build machine has a numpy 1.7 installed in /usr/local/lib/python2.7/dist-packages (or elsewhere) in addition to the standard Precise package in usr/lib/python2.7/dist-packages, and your graph-tool ./configure is finding that one to compile against?
Update... building numpy 1.7.1 from source and installing in default (/usr/local/lib) location is enough to get my test code to work with your python-graph-tool 2.2.25-1 deb package for Precise.
I've left the Precise numpy 1.6.1 installed in /usr/lib so as not to wrestle with other deb package dependencies. The py environment finds the /usr/local/lib (1.7.1) one first.
Cheers,
Mark.
graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool