[Numpy-discussion] Have a problem: what is attribute 'compress'

Todd Miller jmiller at stsci.edu
Thu Jan 23 14:33:03 EST 2003


Sebastian Haase wrote:

>Hi,
>I can print numarray of any int time just fine, but
>
OK.  I am assuming you deleted all of your old numarray installations as 
I recommended and reinstalled numarray-0.4.

What is your PYTHONPATH?

>I still get the compress error message with Float (or complex)
>data:
>  
>
>>>>c
>>>>array([[0, 0, 0, ..., 0, 0, 0],
>>>>        
>>>>
>       [0, 0, 0, ..., 0, 0, 0],
>       [0, 0, 0, ..., 0, 0, 0],
>       ...,
>       [0, 0, 0, ..., 0, 0, 0],
>       [0, 0, 0, ..., 0, 0, 0],
>       [0, 0, 0, ..., 0, 0, 0]], type=UInt16)
>  
>
>>>>c.astype(na.Float)
>>>>        
>>>>
>Traceback (most recent call last):
>  File "<input>", line 1, in ?
>  File "C:\Python22\Lib\site-packages\numarray\numarray.py", line 581, in
>__repr__
>    MAX_LINE_WIDTH, PRECISION, SUPPRESS_SMALL, ', ', 1)
>  File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 163, in
>array2string
>    separator, array_output)
>  File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 125, in
>_array2string
>    format, item_length = _floatFormat(data, precision, suppress_small)
>  File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 246, in
>_floatFormat
>    non_zero = numarray.abs(numarray.compress(numarray.not_equal(data, 0),
>data))
>AttributeError: 'module' object has no attribute 'compress'
>
>I get this on Windows (2000) and on Linux. Both numarray 0.4
>  
>
I'm not sure what's going on here,  but I develop on both platforms, 
 and Linux constantly.    The self tests definitely pass in Linux.   It 
must be some kind of environment issue or runtime issue.  What happens 
when you type:

 >>> import numtestall
 >>> numtestall.test()
... what gets printed here? ...

>Thanks,
>Sebastian
>
>
>
>----- Original Message -----
>From: "Todd Miller" <jmiller at stsci.edu>
>To: "Sebastian Haase" <haase at msg.ucsf.edu>
>Cc: <Numpy-discussion at lists.sourceforge.net>
>Sent: Thursday, December 19, 2002 5:58 AM
>Subject: Re: [Numpy-discussion] Have a problem: what is attribute 'compress'
>
>
>  
>
>>Sebastian Haase wrote:
>>
>>    
>>
>>>Hi!
>>>Somehow I have a problem with numarray. Please take a look at this:
>>>
>>>      
>>>
>>Hi Sebastian,
>>
>>I've don't recall seeing anything like this,  nor can I reproduce it
>>now.   If you've been following numarray for a while now,  I can say
>>that it is important to remove the old version of numarray before
>>installing the new version.   I recommend deleting your current
>>installation and reinstalling numarray.
>>
>>compress() is a ufunc,  much like add() or put().  It is defined in
>>ndarray.py,  right after the import of the modules ufunc and _ufunc.
>>_ufunc in particular is a problematic module,  because it has followed
>>the atypical development path of moving from C-code to Python code.
>> Because of this, and the fact that a .so or .dll overrides a .py,
>> older installations interfere with newer ones.  The atypical path was
>>required because the original _ufuncmodule.c was so large that it could
>>not be compiled on some systems;  as a result,  I split _ufuncmodule.c
>>into pieces by data type and now use _ufunc.py to glue the pieces
>>    
>>
>together.
>  
>
>>Good luck!    Please let me know if reinstalling doesn't clear up the
>>problem.
>>
>>Todd
>>
>>    
>>
>>>      
>>>
>>>>>>import numarray as na
>>>>>>na.array([0, 0])
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>array([0, 0])
>>>
>>>
>>>      
>>>
>>>>>>na.array([0.0, 0.0])
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>Traceback (most recent call last):
>>> File "<input>", line 1, in ?
>>> File "C:\Python22\Lib\site-packages\numarray\numarray.py", line 581, in
>>>__repr__
>>>   MAX_LINE_WIDTH, PRECISION, SUPPRESS_SMALL, ', ', 1)
>>> File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 163,
>>>      
>>>
>in
>  
>
>>>array2string
>>>   separator, array_output)
>>> File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 125,
>>>      
>>>
>in
>  
>
>>>_array2string
>>>   format, item_length = _floatFormat(data, precision, suppress_small)
>>> File "C:\Python22\Lib\site-packages\numarray\arrayprint.py", line 246,
>>>      
>>>
>in
>  
>
>>>_floatFormat
>>>   non_zero = numarray.abs(numarray.compress(numarray.not_equal(data,
>>>      
>>>
>0),
>  
>
>>>data))
>>>AttributeError: 'module' object has no attribute 'compress'
>>>
>>>The same workes fine with Numeric. But I would prefer numarray because
>>>      
>>>
>I'm
>  
>
>>>writing C++-extensions and I need "unsigned shorts".
>>>
>>>What is this error about?
>>>
>>>Thanks,
>>>Sebastian
>>>
>>>
>>>
>>>
>>>-------------------------------------------------------
>>>This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
>>>Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
>>>MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
>>>T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/
>>>_______________________________________________
>>>Numpy-discussion mailing list
>>>Numpy-discussion at lists.sourceforge.net
>>>https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>>>
>>>
>>>      
>>>
>>
>>
>>    
>>
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by:
>SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
>http://www.vasoftware.com
>_______________________________________________
>Numpy-discussion mailing list
>Numpy-discussion at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>  
>







More information about the NumPy-Discussion mailing list