[Biopython-dev] Versions of numpy/Numeric

Bruce Southey bsouthey at gmail.com
Wed Sep 24 17:52:04 EDT 2008


Peter wrote:
>> Hi,
>> With Numeric 24.2 and Numpy 1.2rc2 installed on linux 64bit and Python
>> 2.5.1.
>>     
>
> I don't currently have access to a machine with that setup - so this
> is very useful.  Thanks!
>
>   
>> python python setup.py test gives several deprecation warnings from
>> test_Cluster and test_KDTree but still pass.
>>     
>
> Iteresting - these may be deprecations for Numpy 1.2 - if you have the
> output handy could you share it?  If its very long, you can just send
> it to me off the list (or file a bug with the details).
>   
The not very informative list says it also ''includes a few some minor 
API breakage first scheduled in the 1.1 release"
http://scipy.org/scipy/numpy/milestone/1.2.0

But this is one of them! There is no message in the numpy 1.1 code. 
There is an email on Jul 13, 2008 
(http://www.nabble.com/Newly-deprecated-API-functions-td18436792.html) 
that notes these are depreciated and will be scheduled removed for Numpy 
1.3. So rather annoying!

Sorry, I did not realize until I looked that these were 1.2 related. So 
the relevant output is:

test_Cluster ... test_Cluster.py:584: DeprecationWarning: 
PyArray_FromDims: use 
PyArray_SimpleNew.                                                                      

  matrix = distancematrix(data, mask=mask, 
weight=weight)                                                                                                               

test_Cluster.py:584: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  matrix = distancematrix(data, mask=mask, 
weight=weight)                                                                                                               

test_Cluster.py:629: DeprecationWarning: PyArray_FromDims: use 
PyArray_SimpleNew.                                                                                       

  clusterid, error, nfound = kmedoids(matrix, 
npass=1000)                                                                                                               

test_Cluster.py:629: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  clusterid, error, nfound = kmedoids(matrix, 
npass=1000)                                                                                                               

test_Cluster.py:129: DeprecationWarning: PyArray_FromDims: use 
PyArray_SimpleNew.                                                                                       

  clusterid, error, nfound = kcluster(data, nclusters=nclusters, 
mask=mask, weight=weight, transpose=0, npass=100, method='a', 
dist='e')                               
test_Cluster.py:129: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  clusterid, error, nfound = kcluster(data, nclusters=nclusters, 
mask=mask, weight=weight, transpose=0, npass=100, method='a', 
dist='e')                               
test_Cluster.py:166: DeprecationWarning: PyArray_FromDims: use 
PyArray_SimpleNew.                                                                                       

  clusterid, error, nfound = kcluster(data, nclusters=3, mask=mask, 
weight=weight, transpose=0, npass=100, method='a', 
dist='e')                                       
test_Cluster.py:166: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  clusterid, error, nfound = kcluster(data, nclusters=3, mask=mask, 
weight=weight, transpose=0, npass=100, method='a', 
dist='e')                                       
test_Cluster.py:522: DeprecationWarning: PyArray_FromDims: use 
PyArray_SimpleNew.                                                                                       

  clusterid, celldata = somcluster(data=data, mask=mask, weight=weight, 
transpose=0, nxgrid=10, nygrid=10, inittau=0.02, niter=100, 
dist='e')                          
test_Cluster.py:522: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  clusterid, celldata = somcluster(data=data, mask=mask, weight=weight, 
transpose=0, nxgrid=10, nygrid=10, inittau=0.02, niter=100, 
dist='e')                          
test_Cluster.py:555: DeprecationWarning: PyArray_FromDims: use 
PyArray_SimpleNew.                                                                                       

  clusterid, celldata = somcluster(data=data, mask=mask, weight=weight, 
transpose=0, nxgrid=10, nygrid=10, inittau=0.02, niter=100, 
dist='e')                          
test_Cluster.py:555: DeprecationWarning: 
PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.                                                                     

  clusterid, celldata = somcluster(data=data, mask=mask, weight=weight, 
transpose=0, nxgrid=10, nygrid=10, inittau=0.02, niter=100, 
dist='e')                          
ok                      

test_KDTree ... 
/home/bsouthey/python/biopython_cvs/biopython/build/lib.linux-x86_64-2.5/Bio/KDTree/KDTree.py:71: 
DeprecationWarning: PyArray_FromDims: use PyArray_SimpleNew.
  r=kdt.get_indices()
/home/bsouthey/python/biopython_cvs/biopython/build/lib.linux-x86_64-2.5/Bio/KDTree/KDTree.py:71: 
DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use 
PyArray_NewFromDescr.
  r=kdt.get_indices()
ok

>   
>> test_MarkovModel fails as I found with BioPython 1.48 (Bug 2589). This is
>> most likely a 64-bit thing with Python 2.5.
>>
>> ERROR: test_MarkovModel
>>  ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> ...
>> line 276, in _baum_welch_one
>> lp_initial[:] = lp_arcout_t[:,0]
>>
>> I did notice that both test_MarkovModel.py and test_SVDSuperimposer.py have
>> first try to import Numeric - as does MarkovModel.py.
>>     
>
> Yeah - I'd raised that on the dev list earlier.  Depending on how we
> do this, we'll could end up with misleading import failures (an error
> about Numeric when we really care about numpy).  If however no-one
> objects to completely dropping Numeric for the next release, things
> become much simpler.
>
>   
>> However this same bug is still likely since numpy.oldnumeric is used.
>>     
>
> If you have both Numeric and numpy installed, this module is probably
> using Numeric and thus still fails.  Could you try flipping the
> imports round in .../Bio/MarkovModel.py to see if this problem goes
> away (i.e. make sure it uses numpy instead of Numeric)?
>
> If the problem is still there, would you mind also trying the work
> around you suggested on Bug 2589 please (dropping the [:] from the
> left-hand side)?  If that works for you on both numpy and Numeric it
> seems a worthwhile change for CVS.
>
> Thanks
>
> Peter
>   
Luckily MarkovModel.py is almost self-contained so I used it 
independently of the installation. The test passes as is with numpy and 
if I drop the [:] it passes with both Numeric and numpy import statements.

Bruce



More information about the Biopython-dev mailing list