install bottleneck on linux2 with python 2.5

26 views
Skip to first unread message

Jeff

unread,
Apr 4, 2011, 8:11:20 AM4/4/11
to bottle-neck
Keith,

tried to install Bottleneck 0.4.3 on amd linux; under python 2.5
reports the following (after successful build and install)

Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bottleneck
/usr/lib/python2.5/site-packages/Bottleneck-0.4.3-py2.5-linux-
x86_64.egg/bottleneck/benchmark/bench.py:102: Warning: 'with' will
become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/data/arb/lib/__init__.py", line 26, in <module>

File "/usr/lib/python2.5/site-packages/Bottleneck-0.4.3-py2.5-linux-
x86_64.egg/bottleneck/benchmark/bench.py", line 102
with np.errstate(invalid='ignore'):
^
SyntaxError: invalid syntax
>>

thanks,

Jeff


Keith Goodman

unread,
Apr 10, 2011, 10:49:39 AM4/10/11
to bottl...@googlegroups.com

Sorry for the slow reply. I returned last night from spring vacation.

Thanks for the report. I did not realize that bottleneck 0.4.3
required python 2.6.

I use the `with` statement to quiet the warnings that recent versions
of numpy make when unit testing binary operations with NaNs.

Python 2.5 does have a `with` statement, but I would need to add:

from __future__ import with_statement

As a workaround you could add that to the benchmark and a few unit test modules.

I added your report to the bottleneck issue tracker:
https://github.com/kwgoodman/bottleneck/issues/14

Keith Goodman

unread,
Apr 10, 2011, 1:14:28 PM4/10/11
to bottl...@googlegroups.com

I added

from __future__ import with_statement

to the attached bottleneck. If someone could test it with python 2.5
(I don't have python 2.5) then I'll commit if it works.

Bottleneck-0.5.0dev_32bitOS.tar.gz
Bottleneck-0.5.0dev_64bitOS.tar.gz

Jeff Reback

unread,
Apr 10, 2011, 1:25:10 PM4/10/11
to bottl...@googlegroups.com
I'll give it a try tomorrow
Thxs

I can be reached on my cell 917-971-6387

> <Bottleneck-0.5.0dev_32bitOS.tar.gz>
> <Bottleneck-0.5.0dev_64bitOS.tar.gz>

Jeff Reback

unread,
Apr 11, 2011, 4:59:12 PM4/11/11
to bottl...@googlegroups.com
Built and installed correctly but when I did

import bottleneck as bn
bn.test()

........................FF......FF............
======================================================================
FAIL: Test nanargmin.
----------------------------------------------------------------------

Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/nose-1.0.0-py2.5.egg/nose/case.py", line 187, in runTest
   self.test(*self.arg)
 File "/usr/lib/python2.5/site-packages/bottleneck/tests/func_test.py", line 74, in unit_maker
   assert_equal(da, dd, err_msg % (da, dd))
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 313, in assert_equal
   raise AssertionError(msg)
AssertionError: 
Items are not equal:

func nanargmin | input a4 (int32) | shape (2, 0) | axis -2

Input array:
[]

dtype mismatch int32 int64
ACTUAL: dtype('int32')
DESIRED: dtype('int64')
raise AssertionError("\nItems are not equal:\n\nfunc nanargmin | input a4 (int32) | shape (2, 0) | axis -2\n\nInput array:\n[]\n\n dtype mismatch int32 int64\n ACTUAL: dtype('int32')\n DESIRED: dtype('int64')")


======================================================================
FAIL: Test nanargmax.
----------------------------------------------------------------------

Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/nose-1.0.0-py2.5.egg/nose/case.py", line 187, in runTest
   self.test(*self.arg)
 File "/usr/lib/python2.5/site-packages/bottleneck/tests/func_test.py", line 74, in unit_maker
   assert_equal(da, dd, err_msg % (da, dd))
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 313, in assert_equal
   raise AssertionError(msg)
AssertionError: 
Items are not equal:

func nanargmax | input a4 (int32) | shape (2, 0) | axis -2

Input array:
[]

dtype mismatch int32 int64
ACTUAL: dtype('int32')
DESIRED: dtype('int64')
raise AssertionError("\nItems are not equal:\n\nfunc nanargmax | input a4 (int32) | shape (2, 0) | axis -2\n\nInput array:\n[]\n\n dtype mismatch int32 int64\n ACTUAL: dtype('int32')\n DESIRED: dtype('int64')")


======================================================================
FAIL: Test rankdata.
----------------------------------------------------------------------

Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/nose-1.0.0-py2.5.egg/nose/case.py", line 187, in runTest
   self.test(*self.arg)
 File "/usr/lib/python2.5/site-packages/bottleneck/tests/func_test.py", line 69, in unit_maker
   assert_array_equal(actual, desired, err_msg)
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 686, in assert_array_equal
   verbose=verbose, header='Arrays are not equal')
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 618, in assert_array_compare
   raise AssertionError(msg)
AssertionError: 
Arrays are not equal

func rankdata | input a0 (int32) | shape (0,) | axis -1

Input array:
[]

(mismatch 100.0%)
x: array('Crashed', 
     dtype='|S7')
y: array([], dtype=float64)
raise AssertionError("\nArrays are not equal\n\nfunc rankdata | input a0 (int32) | shape (0,) | axis -1\n\nInput array:\n[]\n\n(mismatch 100.0%)\n x: array('Crashed', \n      dtype='|S7')\n y: array([], dtype=float64)")


======================================================================
FAIL: Test nanrankdata.
----------------------------------------------------------------------

Traceback (most recent call last):
 File "/usr/lib/python2.5/site-packages/nose-1.0.0-py2.5.egg/nose/case.py", line 187, in runTest
   self.test(*self.arg)
 File "/usr/lib/python2.5/site-packages/bottleneck/tests/func_test.py", line 69, in unit_maker
   assert_array_equal(actual, desired, err_msg)
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 686, in assert_array_equal
   verbose=verbose, header='Arrays are not equal')
 File "/usr/lib/python2.5/site-packages/numpy/testing/utils.py", line 618, in assert_array_compare
   raise AssertionError(msg)
AssertionError: 
Arrays are not equal

func nanrankdata | input a0 (int32) | shape (0,) | axis -1

Input array:
[]

(mismatch 100.0%)
x: array('Crashed', 
     dtype='|S7')
y: array([], dtype=float64)
raise AssertionError("\nArrays are not equal\n\nfunc nanrankdata | input a0 (int32) | shape (0,) | axis -1\n\nInput array:\n[]\n\n(mismatch 100.0%)\n x: array('Crashed', \n      dtype='|S7')\n y: array([], dtype=float64)")


----------------------------------------------------------------------
Ran 46 tests in 39.391s

FAILED (failures=4)
Running unit tests for bottleneck
NumPy version 1.5.0b1
NumPy is installed in /usr/lib/python2.5/site-packages/numpy
Python version 2.5.2 (r252:60911, Jan 24 2010, 17:44:40) [GCC 4.3.2]
nose version 1.0.0

<Bottleneck-0.5.0dev_32bitOS.tar.gz>
<Bottleneck-0.5.0dev_64bitOS.tar.gz>

Keith Goodman

unread,
Apr 11, 2011, 5:09:50 PM4/11/11
to bottl...@googlegroups.com

Hmm...Are you using 32 or 64 bit linux? Did you use the corresponding
source distribution?

Jeff Reback

unread,
Apr 11, 2011, 5:15:55 PM4/11/11
to bottl...@googlegroups.com
32 bit
Installed as 0.5dev as u indicated

I can be reached on my cell 917-971-6387

Keith Goodman

unread,
Apr 11, 2011, 5:29:52 PM4/11/11
to bottl...@googlegroups.com
What output does this give on your computer?

import numpy as np
import bottleneck as bn
a = np.ones((2,0), dtype=np.int32)
a.dtype
np.argmin(a, axis=-2).dtype
bn.slow.nanargmin(a, axis=-2).dtype
bn.nanargmin(a, axis=-2).dtype

Jeff Reback

unread,
Apr 11, 2011, 7:57:44 PM4/11/11
to bottl...@googlegroups.com, bottl...@googlegroups.com
[cow-jreback-~] python

Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import numpy as np
import bottleneck as bn
a = np.ones((2,0), dtype=np.int32)
a.dtype
dtype('int32')
np.argmin(a, axis=-2).dtype
dtype('int64')
bn.slow.nanargmin(a, axis=-2).dtype
dtype('int64')
bn.nanargmin(a, axis=-2).dtype
dtype('int32')


I can be reached on my cell 917-971-6387

Keith Goodman

unread,
Apr 11, 2011, 9:18:34 PM4/11/11
to bottl...@googlegroups.com
Thanks, Jeff. I think this is a change or bug in numpy. I recommend
upgrading to numpy 1.5.1.

Since you are using a 32 bit OS I expect that numpy should return 32
bit ints for:

np.argmin(a, axis=-2).dtype

when a is 32 bit ints.

Upgrading numpy should take care of the first two unit test failures
and maybe even the last two.

Jeff Reback

unread,
Apr 11, 2011, 9:28:19 PM4/11/11
to bottl...@googlegroups.com
Sounds reasonable
I will give it a try at some point
When I first installed numpy i wanted to use 64 but version but had some issues installing other (non numpy) libs on windows (as I run on both systems)
And decided on all 32 bit to make life easier

I think maybe il give a shot one of these days to using the other libs

On a side note
One reason I liked your library is o try as a substitute for some of wes's functions in pandas - eg for some basic stat operations with Series

Have u done any tests vs pandas in this regards?

I can be reached on my cell 917-971-6387

Keith Goodman

unread,
Apr 11, 2011, 9:46:33 PM4/11/11
to bottl...@googlegroups.com
On Mon, Apr 11, 2011 at 6:28 PM, Jeff Reback <jeffr...@gmail.com> wrote:
> Sounds reasonable
> I will give it a try at some point

Just a guess. Might not solve anything.

> When I first installed numpy i wanted to use 64 but version but had some issues installing other (non numpy) libs on windows (as I run on both systems)
> And decided on all 32 bit to make life easier

So your linux system is definitely 32 bit?

Here's my system (x86_64):

$ uname -a
Linux kg 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011
x86_64 GNU/Linux

> I think maybe il give a shot one of these days to using the other libs

I don't use windows, but this may be of interest for anyone thinking
about using 64 bit windows:

http://www.lfd.uci.edu/~gohlke/pythonlibs/
http://wiki.cython.org/64BitCythonExtensionsOnWindows

> On a side note
> One reason I liked your library is o try as a substitute for some of wes's functions in pandas - eg for some basic stat operations with Series
>
> Have u done any tests vs pandas in this regards?

I have a package that is similar to pandas. It is called la (for
labeled array). The latest development version (0.5dev) already uses
bottleneck.

doc: http://berkeleyanalytics.com/la
code: https://github.com/kwgoodman/la
mailing list: http://groups.google.com/group/labeled-array

Keith Goodman

unread,
Apr 11, 2011, 9:51:13 PM4/11/11
to bottl...@googlegroups.com
On Mon, Apr 11, 2011 at 6:46 PM, Keith Goodman <kwgo...@gmail.com> wrote:

> So your linux system is definitely 32 bit?
>
> Here's my system (x86_64):
>
> $ uname -a
> Linux kg 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011
> x86_64 GNU/Linux

Here's a check for the default int that numpy uses on your system:

>> np.arange(5).dtype
dtype('int64')

Reply all
Reply to author
Forward
0 new messages