[Numpy-discussion] Status of NumPy and Python 3.3

Ronan Lamy ronan.lamy@gmail....
Sun Jul 29 20:00:23 CDT 2012


Le dimanche 29 juillet 2012 à 14:45 -0700, Ondřej Čertík a écrit :
> Hi Ronan!
> 
> On Sun, Jul 29, 2012 at 2:27 PM, Ronan Lamy <ronan.lamy@gmail.com> wrote:
> > Le samedi 28 juillet 2012 à 18:09 -0700, Ondřej Čertík a écrit :
> >
> >>
> >> So now the PR actually seems to work. The rest of the failures are here:
> >>
> >> https://gist.github.com/3195520
> >>
> > I wanted to have a look at the import errors in your previous gist. How
> > did you get rid of them? I can't even install numpy on 3.3 as setup.py
> 
> Do you mean this gist:
> 
> https://gist.github.com/3194707/482382fb6fd6f0d756128d97ea6c892ddb31fff9
> 
> ? I have incorrectly run the tests from the wrong directory and numpy
> was picking up the wrong files to import --- I think either from the
> numpy directory directly (there is a check for this though), or from
> numpy/core or something, I don't remember anymore. So I then run the
> tests from /tmp and posted the correct result into the same gist as a
> new commit:
> 
> https://gist.github.com/3194707/5696c8d3091b16ba8a9f00a921d512ed02e94d71

Ah, OK. False alarm, then. I'm on the lookout for import errors with
Python 3.3, as the import system has been completely rewritten and
anything that relied on undocumented behaviour is likely to break.
> 
> > chokes on 'import numpy.distutils.core':
> >
> > (py33)ronan@ronan-desktop:~/dev/numpy$ python setup.py install
> > Converting to Python3 via 2to3...
> > Running from numpy source directory.
> > /home/ronan/dev/numpy/py33/lib/python3.3/distutils/__init__.py:16:
> > ResourceWarning: unclosed file <_io.TextIOWrapper
> > name='/usr/local/lib/python3.3/distutils/__init__.py' mode='r'
> > encoding='UTF-8'>
> >   exec(open(os.path.join(distutils_path, '__init__.py')).read())
> > Traceback (most recent call last):
> >   File "setup.py", line 214, in <module>
> >     setup_package()
> >   File "setup.py", line 191, in setup_package
> >     from numpy.distutils.core import setup
> >   File "/home/ronan/dev/numpy/build/py3k/numpy/distutils/core.py", line
> > 25, in <module>
> >     from numpy.distutils.command import config, config_compiler, \
> >   File
> > "/home/ronan/dev/numpy/build/py3k/numpy/distutils/command/__init__.py",
> > line 17, in <module>
> >     __import__('distutils.command',globals(),locals(),distutils_all)
> > ImportError: No module named 'distutils.command.install_clib'
> >
> > Actually, I don't even understand how this __import__() call can work on
> > earlier versions, nor what it's trying to achieve.
> 
> That's weird, I've never seen this error before. Try to install numpy
> using your regular Python like this:
> 
> python setup.py install --prefix /tmp
> 
> let's say. If it works, then something is wrong with your Python 3.3

I simply used a virtualenv (you might need to get the latest from PyPI),
roughly as follows:
virtualenv -p python3.3 py33
py33/bin/python setup.py install

It worked fine with 3.2 and 2.7, but not with 3.3. 

> installation. If you want to reproduce my setup, checkout my repo:
> 
> https://github.com/certik/python-3.3
> 
> and from inside it, run:
> 
> SPKG_LOCAL=`pwd`/xx MAKEFLAGS="-j4" sh spkg-install
> 
> 
> (adjust the "-j4" flag, or remove it). You need a few packages
> installed like zlib1g-dev and so on. Then install virtualenv by
> downloading the tar.gz and from inside it doing
> "/path/to/my/python-3.3/xx/bin/python3.3 setup.py install". Add the
> file
> /path/to/my/python-3.3/xx/bin/virtualenv-3.3 into your $PATH.
> 
> Then:
> 
> 
> rm -rf $HOME/py33
> virtualenv-3.3 $HOME/py33
> . $HOME/py33/bin/activate
> 
> go to your numpy directory and do "python setup.py install". To run
> tests, you also need to:
> 
> TMPDIR=/tmp/numpy-env
> rm -rf $TMPDIR
> mkdir $TMPDIR
> cd $TMPDIR
> tar xzf $tarballs/nose-1.1.2.tar.gz
> cd nose-1.1.2
> python setup.py install
> 
> using the virtualenv environment. When I tried to install nose into
> the python installation in python-3.3./xx, then it failed...

Installing nose from a git checkout works fine for me. Maybe nose-1.1.2
isn't really compatible with Python 3.3?

Anyway, I managed to compile (by blanking
numpy/distutils/command/__init__.py) and to run the tests. I only see
the 2 pickle errors from your latest gist. So that's all good!




More information about the NumPy-Discussion mailing list