[SciPy-user] Pycluster, Numeric, & numpy

Travis Oliphant oliphant at ee.byu.edu
Thu Aug 3 18:15:09 CDT 2006

R. Padraic Springuel wrote:

>I'm trying to do some cluster analysis and running into a small problem. 
>  The cluster package which is included in scipy only does k-means style 
>clustering, and I need to do hierarchical clustering as well.  So I 
>downloaded Pycluster which has that ability.  However, Pycluster uses 
>Numeric, which I no longer have since scipy was upgraded to use numpy 
>instead.  Does anyone have any experience with updating packages to use 
>numpy instead of Numeric?  I tried replacing the "from Numeric import *" 
>line in Pycluster with "from numpy import *" but this creates a program 
>fault which crashes Python.
Are you using a binary version of PyCluster?  This will most certainly 
not work.  You will at least have to alter the extension module 
generated by PyCluster.

It looks like PyCluster uses PyFort for the interface.  Ideally, this 
should be converted to use f2py, but if the pyfort just generated an 
extension module,  then this extension module should compile with NumPy 
just fine as long as the include files are changed to be #include 

There may be some additional corrections that need to be made to the 
python side.  Most of these can be done with the convertcode script. 

There is some talk about creating a fully backward compatible library so 
that you can replace Numeric with numpy.oldnumeric and have code work.  
I'm not sure if we can get 100% of the way there, but maybe.  You will 
still need to re-compile extension modules, though.


More information about the SciPy-user mailing list