[Numpy-discussion] numpy and freeze.py

2007-05-22 Thread Hanno Klemm

Hi,

I want to use freeze.py on code that heavily relies on numpy. If I
just try 

python2.5 /scratch/src/Python-2.5/Tools/freeze/freeze.py pylay.py

the make works but then I get the error:

Traceback (most recent call last):
  File pylay.py, line 1, in module
import kuvBeta4 as kuv
  File kuvBeta4.py, line 6, in module
import mfunBeta4 as mfun
  File mfunBeta4.py, line 2, in module
import numpy
  File
/glb/eu/siep_bv/proj/yot04/apps/python2.5/lib/python2.5/site-packages/numpy/__init__.py,
line 39, in module
import core
  File
/glb/eu/siep_bv/proj/yot04/apps/python2.5/lib/python2.5/site-packages/numpy/core/__init__.py,
line 5, in module
import multiarray
ImportError: No module named multiarray


Am I doing something wrong? Or does freeze.py not work with numpy?

Hanno


-- 
Hanno Klemm
[EMAIL PROTECTED]


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread Robert Kern
Gong, Shawn (Contractor) wrote:
 Hi Robert,
 
 I used exactly your text in site.cfg. The out.txt seems to get the
 lib_dir, but import numpy in python stills gives error.

*What* error? Please copy-and-paste the complete error message.

 Please see the attached files.
 Should I ask system guys to move the libs to /usr/lib so I don't have to
 fight with site.cfg ?

Not until you tell us what the error message is.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread Robert Kern
Gong, Shawn (Contractor) wrote:

 2) Then in Python, when I type import numpy
 It says: Running from numpy source directory
 Then I type numpy.sqrt(5)
 AttributeError: 'module' object has no attribute 'sqrt'
 I assume that this means numpy was not installed successfully.

No, it means that you are running from the numpy source directory. That means it
is picking up the partial numpy package in the source that's used to bootstrap
the installation. Change out of that directory and try again.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread Gong, Shawn (Contractor)
Hi Robert
Running from numpy source directory message also appears when I
installed numpy.
I am running python 2.3.6, not 2.4

You said It is picking up the partial numpy package in the source.  Do
you mean it is picking up the partial numpy package from python 2.3.6 ? 

How do I change out of that directory and try again?

Thanks,
Shawn



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Kern
Sent: Tuesday, May 22, 2007 1:05 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

Gong, Shawn (Contractor) wrote:

 2) Then in Python, when I type import numpy
 It says: Running from numpy source directory
 Then I type numpy.sqrt(5)
 AttributeError: 'module' object has no attribute 'sqrt'
 I assume that this means numpy was not installed successfully.

No, it means that you are running from the numpy source directory. That
means it
is picking up the partial numpy package in the source that's used to
bootstrap
the installation. Change out of that directory and try again.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma
 that is made terrible by our own mad attempt to interpret it as though
it had
 an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread David M. Cooke
On Tue, May 22, 2007 at 01:11:35PM -0400, Gong, Shawn (Contractor) wrote:
 Hi Robert
 Running from numpy source directory message also appears when I
 installed numpy.
 I am running python 2.3.6, not 2.4

Just what it says; the current directory is the directory that the
numpy source is in. If you do 'import numpy' there, it finds the
*source* first, not the installed package.

 You said It is picking up the partial numpy package in the source.  Do
 you mean it is picking up the partial numpy package from python 2.3.6 ? 
 
 How do I change out of that directory and try again?

cd ..

-- 
||\/|
/--\
|David M. Cooke  http://arbutus.physics.mcmaster.ca/dmc/
|[EMAIL PROTECTED]
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread Gong, Shawn (Contractor)
Thank you David M. Cooke and Robert.

Now I changed directory and ran python,
Got further and hit this error message:

python
Python 2.3.6 (#9, May 18 2007, 10:22:59)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-53)] on linux2
Type help, copyright, credits or license for more information.
 import numpy
Traceback (most recent call last):
  File stdin, line 1, in ?
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/__init__.py,
line 40, in ?
import linalg
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/__init__.
py, line 4, in ?
from linalg import *
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/linalg.py
, line 25, in ?
from numpy.linalg import lapack_lite
ImportError: 
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/lapack_lit
e.so: undefined symbol: pthread_join

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy and freeze.py

2007-05-22 Thread Mark Janikas
I cant be sure if your issue is related to mine, so I was wondering
where/when you got your numpy build?

My issue:
http://projects.scipy.org/pipermail/numpy-discussion/2007-April/027000.h
tml

Travis has been kind enough to work with me on it.  His changes are in
the svn.  So, I don't think this is an issue that has arisen due to the
changes unless you have checked numpy out recently and compiled it
yourself.

MJ

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hanno Klemm
Sent: Tuesday, May 22, 2007 9:04 AM
To: numpy-discussion@scipy.org
Subject: [Numpy-discussion] numpy and freeze.py


Hi,

I want to use freeze.py on code that heavily relies on numpy. If I
just try 

python2.5 /scratch/src/Python-2.5/Tools/freeze/freeze.py pylay.py

the make works but then I get the error:

Traceback (most recent call last):
  File pylay.py, line 1, in module
import kuvBeta4 as kuv
  File kuvBeta4.py, line 6, in module
import mfunBeta4 as mfun
  File mfunBeta4.py, line 2, in module
import numpy
  File
/glb/eu/siep_bv/proj/yot04/apps/python2.5/lib/python2.5/site-packages/n
umpy/__init__.py,
line 39, in module
import core
  File
/glb/eu/siep_bv/proj/yot04/apps/python2.5/lib/python2.5/site-packages/n
umpy/core/__init__.py,
line 5, in module
import multiarray
ImportError: No module named multiarray


Am I doing something wrong? Or does freeze.py not work with numpy?

Hanno


-- 
Hanno Klemm
[EMAIL PROTECTED]


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

2007-05-22 Thread Gong, Shawn (Contractor)
Sorry forgot to mention that Python was installed with-thread=no as it
is required for OpenEV application.

I remember that when I installed numarray I had to set --unthreaded

Maybe I need to do the same thing.  Can someone tell me how to set this
flag?

Thanks,
Shawn


-Original Message-
From: Gong, Shawn (Contractor) 
Sent: Tuesday, May 22, 2007 1:28 PM
To: 'Discussion of Numerical Python'
Subject: RE: [Numpy-discussion] FW: RE: Linux numpy 1.0.1 install failed

Thank you David M. Cooke and Robert.

Now I changed directory and ran python,
Got further and hit this error message:

python
Python 2.3.6 (#9, May 18 2007, 10:22:59)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-53)] on linux2
Type help, copyright, credits or license for more information.
 import numpy
Traceback (most recent call last):
  File stdin, line 1, in ?
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/__init__.py,
line 40, in ?
import linalg
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/__init__.
py, line 4, in ?
from linalg import *
  File
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/linalg.py
, line 25, in ?
from numpy.linalg import lapack_lite
ImportError: 
/home/sgong/dev/dist/lib/python2.3/site-packages/numpy/linalg/lapack_lit
e.so: undefined symbol: pthread_join

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] MAX_INT?

2007-05-22 Thread Bill Baxter
Is there a way to obtain the equivalent of MAX_INT for the integral
types numpy knows about?

I know about numpy.finfo for the floating point types, but is there
anything like that for integral types?

Thanks,
--Bill
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] MAX_INT?

2007-05-22 Thread Robert Kern
Bill Baxter wrote:
 Is there a way to obtain the equivalent of MAX_INT for the integral
 types numpy knows about?
 
 I know about numpy.finfo for the floating point types, but is there
 anything like that for integral types?

SVN numpy has numpy.lib.getlimits.iinfo(), now.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] MAX_INT?

2007-05-22 Thread Bill Baxter
Great. Thanks!
Is there a plan to expose that as numpy.iinfo?

--bb

On 5/23/07, Robert Kern [EMAIL PROTECTED] wrote:
 Bill Baxter wrote:
  Is there a way to obtain the equivalent of MAX_INT for the integral
  types numpy knows about?
 
  I know about numpy.finfo for the floating point types, but is there
  anything like that for integral types?

 SVN numpy has numpy.lib.getlimits.iinfo(), now.

 --
 Robert Kern

 I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco
 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] More help with numpy and SWIG

2007-05-22 Thread vallis . 35530053
Hello,

I am trying to use numpy in conjuction with a custom SWIGged C struct
(real_vec_t) that contains array data. I'd like to use the array interface
to share the array data between real_vec_t and numpy. I have two questions
for a combined numpy/SWIG magician:

- This is how I implement the array
interface in real_vec_t, so that if rvt is a real_vec_t instance, I can do
na = numpy.array(rvt) and get a numpy array with the same content. I define
the python attribute,

%extend real_vec_t {
%pythoncode %{
__array_struct__
= property(get_array_struct,doc='Array protocol')
%}
[...]
%}

which
calls the C function (thanks to Lisandro Dalcin for suggesting this)

%extend
real_vec_t {
  PyObject *get_array_struct() {
[...create the PyArrayInterface
pointed to by inter...]
  
[...do Py_INCREF(self) (see below)...]


[...return PyCObject pointing to inter (see below)...]
  }
%}

I have problems with the last two steps. I'm supposed to do a Py_INCREF on
the SWIG object so that the array data is preserved until all numpy arrays
that may come to use it are destroyed. But I don't think it's correct to say
Py_INCREF(self), because in this context self is a pointer to a real_vec_t
structure, not the SWIG PyObject that wraps it... how should I call Py_INCREF?


I have a related problem for the last step. I'm supposed to return 
PyCObject_FromVoidPtrAndDesc(inter,self,inter_free),
where inter is the pointer to the PyArrayInterface, inter_free points to a
function that will free any memory allocated with the PyArrayInterface, and
self, again, should be a pointer to the SWIG wrapper, not just the real_vec_t
C struct.

- The second question is about the conditions under which the
data pointed to by PyArrayInterface is shared with the numpy array I create
with numpy.array(rvt), or it is copied. Is this a function of the flags I
set in PyArrayInterface, of flags that must be passed to numpy.array(), or
both? I couldn't quite dig this out of the numpy manual (but will happily
take a pointer to the discussion therein...)

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion