cannot import MPI in python 3.3

867 views
Skip to first unread message

carl....@gmail.com

unread,
Nov 30, 2012, 7:33:40 PM11/30/12
to mpi...@googlegroups.com
I'm getting the following error when I try to use mpi4py 1.3-2 in python 3.3. I can run the same command under python 2.7 with an install of mpi4py 1.3-2. I'm on Arch Linux 3.6.8.

I couldn't find via Google anyone having similar problems. I also couldn't locate src/mpi4py.MPI.c in the source tree (I think Cython is generating this file) so I can't see what's generating the error.

Has anyone seen this before or does anyone have a suggestion how I can go about debugging this problem? Any help appreciated,

Carl

[carl@mycomp tmp-carl]$ ipython
Python 3.3.0 (default, Sep 29 2012, 15:50:43)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python'
s own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from mpi4py import MPI
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-fc57324fa516> in <module>()
----> 1 from mpi4py import MPI

/dev/shm/tmp-carl/asarray.pxi in init mpi4py.MPI (src/mpi4py.MPI.c:98336)()

ValueError: level must be >= 0

In [2]:


Lisandro Dalcin

unread,
Dec 1, 2012, 10:02:19 AM12/1/12
to mpi4py
On 30 November 2012 21:33, <carl....@gmail.com> wrote:
> I'm getting the following error when I try to use mpi4py 1.3-2 in python
> 3.3. I can run the same command under python 2.7 with an install of mpi4py
> 1.3-2. I'm on Arch Linux 3.6.8.
>

So you are using mpi4py from your distro. I guess that the
Cython-generated files for the last mpi4py release could be outdated
for Python-3.3.

I really need to make a new mpi4py release, but I'm waiting for MPICH
folks to release mpich-3.0 with support for the new MPI 3.0 standard.

> I couldn't find via Google anyone having similar problems. I also couldn't
> locate src/mpi4py.MPI.c in the source tree (I think Cython is generating
> this file) so I can't see what's generating the error.
>
> Has anyone seen this before or does anyone have a suggestion how I can go
> about debugging this problem? Any help appreciated,
>

AFAICT, mpi4py-dev is working fine for me.

Could you try to clone mpi4py's mercurial repository, and try to buid
(install Cython first) and install in you user site directory
(python3.3 setup.py install --user) ?




--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

carl

unread,
Dec 1, 2012, 12:08:03 PM12/1/12
to mpi...@googlegroups.com
Hi Lisandro, thanks for the suggestions. In addition to my distro's binary, when I use pip to install the 1.3.2 I get the same problem.

Yesterday I downgraded to the previous release (1.2.2 I think) and it works fine with python3.3.

I also cloned the mercurial repo (changeset 936:8334e2d2c978) and installed as you suggested and it works fine, so thanks for pointing that out! Let me know if you want me to try anything else to debug what the problem is with the 1.3.2 release (I'm still not sure what's going on with it).

Carl

Lisandro Dalcin

unread,
Dec 1, 2012, 1:23:14 PM12/1/12
to mpi4py
On 1 December 2012 14:08, carl <carl....@gmail.com> wrote:
> Hi Lisandro, thanks for the suggestions. In addition to my distro's binary,
> when I use pip to install the 1.3.2 I get the same problem.
>
> Yesterday I downgraded to the previous release (1.2.2 I think) and it works
> fine with python3.3.
>
> I also cloned the mercurial repo (changeset 936:8334e2d2c978) and installed
> as you suggested and it works fine, so thanks for pointing that out! Let me
> know if you want me to try anything else to debug what the problem is with
> the 1.3.2 release (I'm still not sure what's going on with it).
>

Could you try the following? Download the latest mpi4py tarball, and
unpack it, then do (I assume you have Cython installed):

$ cd mpi4py-1.3
$ ./conf/cythonize.sh # rebuild sources with your newer Cython
$ python3.3 setup.py build
$ python3.3 test/runtests.py

If this works, then your issue is surely related to mpi4py's Cython
sources being a bit outdated for Python 3.3... Perhaps you can bug the
Arch Linux maintainer, all he needs to do to fix the issue is to run
the ./conf/cythonize.sh script to regenerate the sources before
building.
Reply all
Reply to author
Forward
0 new messages