Re: [Numpy-discussion] Numpy and Python3

2010-12-12 Thread Katharina
Hi Chuck,
You are right, it works.
I had so many versions of Numpy, that in the end I lost track.
*Sorry*

But now it works perfectly.
Thank you for the help.

/Ingwer


ps: I know SciPY has its own Mail list, but it could be, that somebody
can answer my question.
Does SciPy works on Python3.1? 




Am Samstag, den 11.12.2010, 13:19 -0700 schrieb Charles R Harris:
 
 
 On Sat, Dec 11, 2010 at 12:58 PM, Katharina ingwer.wur...@gmx.net
 wrote:
 Oh... the Problem with python2.6 is solved.
 I take the numpy Version,  which was transformed with 2to3.
 
 
 Wait, how did you do that? Setup should automatically select the right
 version.
 
 Chuck 
 
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-12 Thread Charles R Harris
On Sun, Dec 12, 2010 at 11:06 AM, Katharina ingwer.wur...@gmx.net wrote:

 Hi Chuck,
 You are right, it works.
 I had so many versions of Numpy, that in the end I lost track.
 *Sorry*

 But now it works perfectly.
 Thank you for the help.

 /Ingwer


 ps: I know SciPY has its own Mail list, but it could be, that somebody
 can answer my question.
 Does SciPy works on Python3.1?


Support for 3.1 will be in the next scipy release. It should be available in
4-6 weeks.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-12 Thread Katharina
ok, thanks

/Ingwer

Am Sonntag, den 12.12.2010, 12:23 -0700 schrieb Charles R Harris:
 
 
 On Sun, Dec 12, 2010 at 11:06 AM, Katharina ingwer.wur...@gmx.net
 wrote:
 Hi Chuck,
 You are right, it works.
 I had so many versions of Numpy, that in the end I lost track.
 *Sorry*
 
 But now it works perfectly.
 Thank you for the help.
 
 /Ingwer
 
 
 ps: I know SciPY has its own Mail list, but it could be, that
 somebody
 can answer my question.
 Does SciPy works on Python3.1?
 
 
 Support for 3.1 will be in the next scipy release. It should be
 available in 4-6 weeks.
 
 Chuck 
 
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-11 Thread Katharina
Hi,
I install Python3.1, but I get the same Error:

sudo python3 setup.py build --fcompiler=gnu95
Converting to Python3 via 2to3...
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: No files need to be modified.
Running from numpy source directory.Traceback (most recent call last):
  File setup.py, line 211, in module
setup_package()
  File setup.py, line 188, in setup_package
from numpy.distutils.core import setup
  File
/usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/__init__.py,
 line 22, in module
import numpy.distutils.ccompiler
  File
/usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/ccompiler.py,
 line 15, in module
from numpy.distutils.exec_command import exec_command
  File
/usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/exec_command.py,
 line 58, in module
from numpy.compat import open_latin1
  File
/usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/compat/__init__.py,
 line 14, in module
from .py3k import *
AttributeError: 'module' object has no attribute 'unicode'



Can somebody see, what's the problem?
I'm really pleased for any help. 

/With kind regards
Ingwer


Am Freitag, den 10.12.2010, 20:05 +0800 schrieb Ralf Gommers:
 
 
 On Fri, Dec 10, 2010 at 6:33 PM, Katharina ingwer.wur...@gmx.net
 wrote:
 Hello everyone,
 
 first, I'm really apologise for my English-skills. But I have
 only one
 simple questions. Does NumPy work on Python3 now.
 I read so many articles on the Internet, but you can only read
 some
 speculation and not a clear state about this topic.
 
 It works fine with Python 3.1.  
 
 
 At the moment I try numpy1.5.1 on Python3.0, but I get only
 Errors.
 If Numpy works on Python3, are the support libraries the same
 as by
 Python2.6?
 
 Which support libraries? Just Lapack/Blas or Atlas should be all you
 need, and just $ python3.1 setup.py install
 --prefix=/home/XXX/pick-a-folder should work fine.
 
 If you encounter a problem, please send us the exact build command you
 used, the build log and compiler versions.
 
 Ralf
 

 
 (By the way, I use Linux (Ubuntu 9.04)) 
 
 /With kind regards
 Ingwer
 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-11 Thread Charles R Harris
On Sat, Dec 11, 2010 at 5:41 AM, Katharina ingwer.wur...@gmx.net wrote:

 Hi,
 I install Python3.1, but I get the same Error:

 
 sudo python3 setup.py build --fcompiler=gnu95
 Converting to Python3 via 2to3...
 RefactoringTool: Skipping implicit fixer: buffer
 RefactoringTool: Skipping implicit fixer: idioms
 RefactoringTool: Skipping implicit fixer: set_literal
 RefactoringTool: Skipping implicit fixer: ws_comma
 RefactoringTool: No files need to be modified.
 Running from numpy source directory.Traceback (most recent call last):
  File setup.py, line 211, in module
setup_package()
  File setup.py, line 188, in setup_package
from numpy.distutils.core import setup
  File
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/__init__.py,
 line 22, in module
import numpy.distutils.ccompiler


Are you doing the build in  /usr/local/lib/python3.1/site-packages/ ?
Usually the build is done in a working directory and installed by python
setup.py install. I don't know that that is the problem, but it is unusual.

 File
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/ccompiler.py,
 line 15, in module
from numpy.distutils.exec_command import exec_command
  File
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/exec_command.py,
 line 58, in module
from numpy.compat import open_latin1
  File
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/compat/__init__.py,
 line 14, in module
from .py3k import *
 AttributeError: 'module' object has no attribute 'unicode'


 

 Can somebody see, what's the problem?
 I'm really pleased for any help.


snip

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-11 Thread Katharina
Hi,
yes my build is in /usr/local/lib/python3.1/site-packages/numpy-1.5.1.
Is't wrong?

/ Ingwer

Am Samstag, den 11.12.2010, 08:05 -0700 schrieb Charles R Harris:
 
 
 On Sat, Dec 11, 2010 at 5:41 AM, Katharina ingwer.wur...@gmx.net
 wrote:
 Hi,
 I install Python3.1, but I get the same Error:
 
 
 sudo python3 setup.py build --fcompiler=gnu95
 Converting to Python3 via 2to3...
 RefactoringTool: Skipping implicit fixer: buffer
 RefactoringTool: Skipping implicit fixer: idioms
 RefactoringTool: Skipping implicit fixer: set_literal
 RefactoringTool: Skipping implicit fixer: ws_comma
 RefactoringTool: No files need to be modified.
 Running from numpy source directory.Traceback (most recent
 call last):
  File setup.py, line 211, in module
setup_package()
  File setup.py, line 188, in setup_package
from numpy.distutils.core import setup
  File
 
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/__init__.py,
  line 22, in module
import numpy.distutils.ccompiler
 
 Are you doing the build in  /usr/local/lib/python3.1/site-packages/ ?
 Usually the build is done in a working directory and installed by
 python setup.py install. I don't know that that is the problem, but
 it is unusual.
 
 
  File
 
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/ccompiler.py,
  line 15, in module
from numpy.distutils.exec_command import exec_command
  File
 
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/distutils/exec_command.py,
  line 58, in module
from numpy.compat import open_latin1
  File
 
 /usr/local/lib/python3.1/site-packages/numpy-1.5.1/build/py3k/numpy/compat/__init__.py,
  line 14, in module
from .py3k import *
 AttributeError: 'module' object has no attribute 'unicode'
 
 
 
 
 Can somebody see, what's the problem?
 I'm really pleased for any help.
 
 
 snip
 
 Chuck 
 
 ___
 NumPy-Discussion mailing list
 NumPy-Discussion@scipy.org
 http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-11 Thread Charles R Harris
On Sat, Dec 11, 2010 at 11:53 AM, Katharina ingwer.wur...@gmx.net wrote:

 Hi,
 yes my build is in /usr/local/lib/python3.1/site-packages/numpy-1.5.1.
 Is't wrong?


Well, let's find out ;) Move your numpy download somewhere like
~/numpy-1.5.1, then do

cd numpy-1.5.1
python3.1 setup.py build
sudo python3.1 setup.py install

You should probably also do

sudo rm -rf  /usr/local/lib/python3.1/site-packages/numpy-1.5.1 before the
build as well as remove your local build directory. You might also need to
change ownership of the files from root to yourself.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Numpy and Python3

2010-12-10 Thread Katharina
Hello everyone,

first, I'm really apologise for my English-skills. But I have only one
simple questions. Does NumPy work on Python3 now.
I read so many articles on the Internet, but you can only read some
speculation and not a clear state about this topic.

At the moment I try numpy1.5.1 on Python3.0, but I get only Errors.
If Numpy works on Python3, are the support libraries the same as by
Python2.6? 
(By the way, I use Linux (Ubuntu 9.04))

/With kind regards
Ingwer

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-10 Thread Ralf Gommers
On Fri, Dec 10, 2010 at 6:33 PM, Katharina ingwer.wur...@gmx.net wrote:

 Hello everyone,

 first, I'm really apologise for my English-skills. But I have only one
 simple questions. Does NumPy work on Python3 now.
 I read so many articles on the Internet, but you can only read some
 speculation and not a clear state about this topic.


It works fine with Python 3.1.


 At the moment I try numpy1.5.1 on Python3.0, but I get only Errors.
 If Numpy works on Python3, are the support libraries the same as by
 Python2.6?


Which support libraries? Just Lapack/Blas or Atlas should be all you need,
and just $ python3.1 setup.py install --prefix=/home/XXX/pick-a-folder
should work fine.

If you encounter a problem, please send us the exact build command you used,
the build log and compiler versions.

Ralf



 (By the way, I use Linux (Ubuntu 9.04))


 /With kind regards
 Ingwer


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy and Python3

2010-12-10 Thread Charles R Harris
On Fri, Dec 10, 2010 at 3:33 AM, Katharina ingwer.wur...@gmx.net wrote:

 Hello everyone,

 first, I'm really apologise for my English-skills. But I have only one
 simple questions. Does NumPy work on Python3 now.
 I read so many articles on the Internet, but you can only read some
 speculation and not a clear state about this topic.

 At the moment I try numpy1.5.1 on Python3.0, but I get only Errors.
 If Numpy works on Python3, are the support libraries the same as by
 Python2.6?
 (By the way, I use Linux (Ubuntu 9.04))


We don't support 3.0, only 3.1 and above.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-24 Thread René Dudfield
On Mon, Nov 23, 2009 at 7:19 AM, David Cournapeau courn...@gmail.com wrote:
 On Mon, Nov 23, 2009 at 2:35 PM, Pauli Virtanen p...@iki.fi wrote:

 It might be nice to have this merged in at some point after 1.4.0 (after
 the most obvious glaring bugs have been fixed), so that we could perhaps
 start aiming for Python3 compatibility in Numpy 1.5.0.

 One thing I have on my end is a numpy.distutils which runs under both
 python 2 and 3, so that you don't have to run 2to3 everytime you make
 a change.

 I did not put it in the trunk because I did not want to modify
 numpy.distutils for 1.4.0 at this point, but I will include the
 changes as soon as I branch the trunk into 1.4.0,


hi,

my tree has this fairly far along (2 and 3 compatible).


cheers,
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-24 Thread René Dudfield
awesome work Pauli!
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-24 Thread René Dudfield
On Mon, Nov 23, 2009 at 10:08 AM, Pauli Virtanen p...@iki.fi wrote:
 Setup.py runs 2to3 automatically for all changed files. Of course, if it's 
 possible to cater for24 and 3 at the same time,that's good. How do you work 
 around the relative imports andthe changed exception catching syntax?


hi,

see my tree for how I did these things.  http://github.com/illume/numpy3k

I'm not sure I like how I handled the changed relative imports.
However the exception handling is fairly easy/clean to do.


cheers,
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Pauli Virtanen
Setup.py runs 2to3 automatically for all changed files. Of course, if it's 
possible to cater for24 and 3 at the same time,that's good. How do you work 
around the relative imports andthe changed exception catching syntax?

-- alkuper. viesti --
Aihe: Re: [Numpy-discussion] Numpy on Python3
Lähettäjä: David Cournapeau courn...@gmail.com
Päivämäärä: 23.11.2009 08:19

On Mon, Nov 23, 2009 at 2:35 PM, Pauli Virtanen p...@iki.fi wrote:

 It might be nice to have this merged in at some point after 1.4.0 (after
 the most obvious glaring bugs have been fixed), so that we could perhaps
 start aiming for Python3 compatibility in Numpy 1.5.0.

One thing I have on my end is a numpy.distutils which runs under both
python 2 and 3, so that you don't have to run 2to3 everytime you make
a change.

I did not put it in the trunk because I did not want to modify
numpy.distutils for 1.4.0 at this point, but I will include the
changes as soon as I branch the trunk into 1.4.0,

David
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Pauli Virtanen
The issue with longs is that we wouldn't want array([1,2,3]) create object 
arrays -- so we need to decide on casting rules for longs. Currently, I think 
they're treated like python2 ints.

-- alkuper. viesti --
Aihe: Re: [Numpy-discussion] Numpy on Python3
Lähettäjä: Charles R Harris charlesr.har...@gmail.com
Päivämäärä: 23.11.2009 08:08

On Sun, Nov 22, 2009 at 10:35 PM, Pauli Virtanen p...@iki.fi wrote:

 http://github.com/pv/numpy-work/tree/py3k

 $ mkdir -p $PWD/dist/lib/python3.1/site-packages
 $ python3 setup.py install --prefix=$PWD/dist
 $ cd $PWD/dist/lib/python3.1/site-packages  python3
 Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16)
 [GCC 4.4.1] on linux2
 Type help, copyright, credits or license for more information.
  import numpy
 XXX: 3K: numpy.random is disabled for now, uses PyString_*
 XXX: 3K: numpy.ma is disabled for now -- some issues
  numpy.array([1., 2, 3, 4])
 array([ 1.,  2.,  3.,  4.])
  _ + 10
 array([ 11.,  12.,  13.,  14.])
  numpy.ones((4,), dtype=complex)/4
 array([ 0.25+0.j,  0.25+0.j,  0.25+0.j,  0.25+0.j])
  numpy.array([object(), object()])
 array([object object at 0xb7778810, object object at 0xb7778d90],
 dtype=b'object')

***

 Things were fairly straightforward this far, just many tiny changes.
 What's left is then sorting out the bigger problems :)

 This is still far from being complete:

 - Most use of PyString_* needs auditing (note e.g. the b'object' in the
  dtype print above...).

  I simply added convenience wrappers for PyString - PyBytes,
  but this is not the correct choice at all points.

 - Also, should dtype='S' be Bytes or Unicode? I chose Bytes for now.

 - Whether to inherit Numpy ints from PyLong_* needs some thinking,
  as they are quite different objects. Now, I dropped the inheritance,
  but I wonder if this will break something.


Maybe. But it was always a hassle because it behaved differently than the
other integer types. Now onto float ;)


 - PyFile_AsFile has disappeared, and AsFileDescriptor+fdopen doesn't
  seem to cut it -- don't know exactly what's wrong here.

 - Integer - String formatting does not seem to work

 - Larger-than-long-long Python ints probably cause problems


We used a python call which would raise an error if the number was too
large. If that call is still valid, things should work.


 - The new buffer interface needs to be implemented -- currently there
  are just error-raising stubs.

  I remember Dag was working on this a bit: how far did it go?

 - Relative imports + 2to3 is a bit of a pain. A pity we can't have
  them in the mainline code because of python2.4.

 - I didn't check for semantic changes in tp_* interface functions.
  This we need still to do.


I left some notes in the src folder. If you discover anything new put it in
there.


 - And probably many other issues lurking.


We do need to look at the initialization of the type math stuff in the
ufuncobject module. Yeah, its a bit of a circular dependency, one reason it
would be nice to have ufuncs operate on buffer objects instead of ndarrays
would be to break the mutual dependence.



 Also, I didn't yet try checking how far the test suite passes on
 Python3. (It still passes completely on Python2, so at least I didn't
 break that part.)

 It might be nice to have this merged in at some point after 1.4.0 (after
 the most obvious glaring bugs have been fixed), so that we could perhaps
 start aiming for Python3 compatibility in Numpy 1.5.0.


If you want to see real suffering, look at the programmer notes in the
hacked CRU files.  Some poor sucker was stuck with fixing up the g*dawful
code while also needing to determine what data was in undocumented binary
files, some with the same names but containing different data. Folks, don't
let that happen to you. The conversion to Py3k is going to be a breeze by
comparison.

Chuck

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread David Cournapeau
Pauli Virtanen wrote:
 Setup.py runs 2to3 automatically for all changed files.

Yes, but I think it is more practical to have the build process to be 2
and 3-compatible.

  Of course, if it's possible to cater for24 and 3 at the same time,that's 
 good. How do you work around the relative imports andthe changed exception 
 catching syntax?
   

For the exception catching, one can have a few utilities to walk through
the stack - I don't remember how I did it for the relative import, but
this was not a pb IIRC.

I am quite disappointed that numscons will not be usable in the
foreseable future for py3k, I hoped it would have been simpler than
numpy.distutils, but porting scons to py3k is too big of a task.

cheers,

David
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Pauli Virtanen
Mon, 23 Nov 2009 01:40:00 -0500, Pierre GM wrote:
[clip]
 XXX: 3K: numpy.ma is disabled for now -- some issues
 
 What are the issues ?

Something resolving which would have taken more than 5 minutes :) 
Possibly because something that ma depends on is currently broken in 
numpy.core.

I just wanted to breeze through and arrive as fast as possible at 
something that can be imported and works for simple things, so I didn't 
stop at anything that would take longer. I'll take a look at the rest 
later on.

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Pauli Virtanen
Mon, 23 Nov 2009 08:58:47 +0100, Sturla Molden wrote:
 Pauli Virtanen skrev:
 XXX: 3K: numpy.random is disabled for now, uses PyString_* XXX: 3K:
 numpy.ma is disabled for now -- some issues
   
 I thought numpy.random uses Cython? Is it just a matter of recompiling
 the pyx-file?

The Cython file uses the C-api directly, so we'll need a .h file with the 
necessary compile-time conditionals.

   I remember Dag was working on this a bit: how far did it go?

 Cython's include file numpy.pxd has an ndarray class that extend
 PyArrayObject with PEP 3118 buffer compatibility.

Great! I believe I will just steal whatever I can and rewrite it in C -- 
for now, it seems possible to keep Numpy's core in plain C.

-- 
Pauli Virtanen

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Pierre GM
On Nov 23, 2009, at 4:36 AM, Pauli Virtanen wrote:
 Mon, 23 Nov 2009 01:40:00 -0500, Pierre GM wrote:
 [clip]
 XXX: 3K: numpy.ma is disabled for now -- some issues
 
 What are the issues ?
 
 Something resolving which would have taken more than 5 minutes :) 
 Possibly because something that ma depends on is currently broken in 
 numpy.core.

Fair enough, fair enough...
But y'all, please let me know potential issues (not that I'll be able to work 
on it anytime soon, but just in case...).
P.

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-23 Thread Dag Sverre Seljebotn
Pauli Virtanen wrote:
 Mon, 23 Nov 2009 08:58:47 +0100, Sturla Molden wrote:
   
 Pauli Virtanen skrev:
 
 XXX: 3K: numpy.random is disabled for now, uses PyString_* XXX: 3K:
 numpy.ma is disabled for now -- some issues
   
   
 I thought numpy.random uses Cython? Is it just a matter of recompiling
 the pyx-file?
 

 The Cython file uses the C-api directly, so we'll need a .h file with the 
 necessary compile-time conditionals.

   
   I remember Dag was working on this a bit: how far did it go?
   
 Cython's include file numpy.pxd has an ndarray class that extend
 PyArrayObject with PEP 3118 buffer compatibility.
 

 Great! I believe I will just steal whatever I can and rewrite it in C -- 
 for now, it seems possible to keep Numpy's core in plain C.
   
I did sit down with David to learn enough to do this and had a brief 
start on doing it properly for NumPy on SciPy 2009 (with seperate 
testcases and the buffer format string stored directly in the NumPy 
dtype structs on creation). I meant to come back to it in November but 
due to becoming sick etc. etc. that's no longer possible. If nothing 
happens by the mid/end of January I still hope to be able to do this 
then. Feel free to ask any questions about the buffer PEP if you do go 
forward with this as I've used it a lot in Cython (and wrote the 
implementation on behalf of NumPy there).

The Cython numpy.pxd does:
 - Temporarily allocate buffers for the format string, this is 
inefficient as NumPy can store them directly in the dtype when the dtype 
is constructed
 - Not support non-native endian (and some other relevant packing 
formats I believe)
 - Not support the string types
 - Not support dtypes with nested sub-arrays within records

What is done: David added some code (at least in some branch) that 
ensures that sizeof(npy_intp) == sizeof(Py_ssize_t) on Python 2.6+. 
(I.e. if that assumption is violated NumPy won't compile, so we're free 
to assume it until the issue of using npy_intp for indices is fixed on a 
more fundamental level in NumPy). This means that the shapes/strides in 
Py_buffer can be directed directly to the dimensions/strides in the 
NumPy array struct (whereas Cython's numpy.pxd has to make a copy on 
some platforms for Python 2.4).

Dag Sverre
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Numpy on Python3

2009-11-22 Thread Pauli Virtanen
http://github.com/pv/numpy-work/tree/py3k

$ mkdir -p $PWD/dist/lib/python3.1/site-packages
$ python3 setup.py install --prefix=$PWD/dist
$ cd $PWD/dist/lib/python3.1/site-packages  python3
Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16) 
[GCC 4.4.1] on linux2
Type help, copyright, credits or license for more information.
 import numpy
XXX: 3K: numpy.random is disabled for now, uses PyString_*
XXX: 3K: numpy.ma is disabled for now -- some issues
 numpy.array([1., 2, 3, 4])
array([ 1.,  2.,  3.,  4.])
 _ + 10
array([ 11.,  12.,  13.,  14.])
 numpy.ones((4,), dtype=complex)/4
array([ 0.25+0.j,  0.25+0.j,  0.25+0.j,  0.25+0.j])
 numpy.array([object(), object()])
array([object object at 0xb7778810, object object at 0xb7778d90],
dtype=b'object')

***

Things were fairly straightforward this far, just many tiny changes.
What's left is then sorting out the bigger problems :)

This is still far from being complete:

- Most use of PyString_* needs auditing (note e.g. the b'object' in the
  dtype print above...).

  I simply added convenience wrappers for PyString - PyBytes,
  but this is not the correct choice at all points.

- Also, should dtype='S' be Bytes or Unicode? I chose Bytes for now.

- Whether to inherit Numpy ints from PyLong_* needs some thinking,
  as they are quite different objects. Now, I dropped the inheritance,
  but I wonder if this will break something.

- PyFile_AsFile has disappeared, and AsFileDescriptor+fdopen doesn't
  seem to cut it -- don't know exactly what's wrong here.

- Integer - String formatting does not seem to work

- Larger-than-long-long Python ints probably cause problems

- The new buffer interface needs to be implemented -- currently there
  are just error-raising stubs.

  I remember Dag was working on this a bit: how far did it go?

- Relative imports + 2to3 is a bit of a pain. A pity we can't have
  them in the mainline code because of python2.4.

- I didn't check for semantic changes in tp_* interface functions.
  This we need still to do.

- And probably many other issues lurking.


Also, I didn't yet try checking how far the test suite passes on
Python3. (It still passes completely on Python2, so at least I didn't
break that part.)

It might be nice to have this merged in at some point after 1.4.0 (after
the most obvious glaring bugs have been fixed), so that we could perhaps
start aiming for Python3 compatibility in Numpy 1.5.0.

Cheers,
Pauli




___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-22 Thread David Cournapeau
On Mon, Nov 23, 2009 at 2:35 PM, Pauli Virtanen p...@iki.fi wrote:

 It might be nice to have this merged in at some point after 1.4.0 (after
 the most obvious glaring bugs have been fixed), so that we could perhaps
 start aiming for Python3 compatibility in Numpy 1.5.0.

One thing I have on my end is a numpy.distutils which runs under both
python 2 and 3, so that you don't have to run 2to3 everytime you make
a change.

I did not put it in the trunk because I did not want to modify
numpy.distutils for 1.4.0 at this point, but I will include the
changes as soon as I branch the trunk into 1.4.0,

David
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-22 Thread Charles R Harris
On Sun, Nov 22, 2009 at 10:35 PM, Pauli Virtanen p...@iki.fi wrote:

 http://github.com/pv/numpy-work/tree/py3k

 $ mkdir -p $PWD/dist/lib/python3.1/site-packages
 $ python3 setup.py install --prefix=$PWD/dist
 $ cd $PWD/dist/lib/python3.1/site-packages  python3
 Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16)
 [GCC 4.4.1] on linux2
 Type help, copyright, credits or license for more information.
  import numpy
 XXX: 3K: numpy.random is disabled for now, uses PyString_*
 XXX: 3K: numpy.ma is disabled for now -- some issues
  numpy.array([1., 2, 3, 4])
 array([ 1.,  2.,  3.,  4.])
  _ + 10
 array([ 11.,  12.,  13.,  14.])
  numpy.ones((4,), dtype=complex)/4
 array([ 0.25+0.j,  0.25+0.j,  0.25+0.j,  0.25+0.j])
  numpy.array([object(), object()])
 array([object object at 0xb7778810, object object at 0xb7778d90],
 dtype=b'object')

***

 Things were fairly straightforward this far, just many tiny changes.
 What's left is then sorting out the bigger problems :)

 This is still far from being complete:

 - Most use of PyString_* needs auditing (note e.g. the b'object' in the
  dtype print above...).

  I simply added convenience wrappers for PyString - PyBytes,
  but this is not the correct choice at all points.

 - Also, should dtype='S' be Bytes or Unicode? I chose Bytes for now.


Yeah, this needs deciding. I think compatibility with old files requires
Bytes, we can't change file formats and keep compatibility.

BTW, I made some changes for py3k that depend on the macro NPY_PY3K being
defined, but didn't actually define it anywhere. It needs to go in one of
the include files.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-22 Thread Pierre GM
On Nov 23, 2009, at 12:35 AM, Pauli Virtanen wrote:
 http://github.com/pv/numpy-work/tree/py3k
 
 $ mkdir -p $PWD/dist/lib/python3.1/site-packages
 $ python3 setup.py install --prefix=$PWD/dist
 $ cd $PWD/dist/lib/python3.1/site-packages  python3
 Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16) 
 [GCC 4.4.1] on linux2
 Type help, copyright, credits or license for more information.
 import numpy
 XXX: 3K: numpy.random is disabled for now, uses PyString_*
 XXX: 3K: numpy.ma is disabled for now -- some issues


What are the issues ?

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Numpy on Python3

2009-11-22 Thread Sturla Molden
Pauli Virtanen skrev:
 XXX: 3K: numpy.random is disabled for now, uses PyString_*
 XXX: 3K: numpy.ma is disabled for now -- some issues
   
I thought numpy.random uses Cython? Is it just a matter of recompiling 
the pyx-file?


   I remember Dag was working on this a bit: how far did it go?

   
Cython's include file numpy.pxd has an ndarray class that extend 
PyArrayObject with PEP 3118 buffer compatibility.


___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion