[petsc-users] Building petsc4py / mpi4py

Florian Lindner mailinglists at xgm.de
Mon Jan 23 08:10:11 CST 2017



Am 23.01.2017 um 14:24 schrieb Matthew Knepley:
> On Mon, Jan 23, 2017 at 7:05 AM, Florian Lindner <mailinglists at xgm.de <mailto:mailinglists at xgm.de>> wrote:
> 
> 
> 
>     Am 23.01.2017 um 13:59 schrieb Matthew Knepley:
>     > On Mon, Jan 23, 2017 at 6:38 AM, Florian Lindner <mailinglists at xgm.de <mailto:mailinglists at xgm.de>
>     <mailto:mailinglists at xgm.de <mailto:mailinglists at xgm.de>>> wrote:
>     >
>     >     Hello,
>     >
>     >     I try to build petsc from the maint branch together with petsc4py and mpi4py
>     >
>     >     python2 configure --download-petsc4py=yes --download-mpi4py=yes --with-mpi4py=yes --with-petsc4py=yes
>     --with-debugging=1
>     >     make
>     >
>     >     works without errors, so does make test.
>     >
>     >     % echo $PYTHONPATH
>     >     /home/florian/software/petsc/arch-linux2-c-debug/lib
>     >
>     >     % ls $PYTHONPATH
>     >     libpetsc.so  libpetsc.so.3.7  libpetsc.so.3.7.5  mpi4py  mpi4py-1.3.1-py3.6.egg-info  petsc  petsc4py
>     >     petsc4py-3.7.0-py3.6.egg-info  pkgconfig
>     >
>     >
>     >     but:
>     >
>     >     % python2 RBF_Load.py
>     >     Traceback (most recent call last):
>     >       File "RBF_Load.py", line 10, in <module>
>     >         petsc4py.init(sys.argv)
>     >       File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/__init__.py", line 42, in init
>     >         PETSc = petsc4py.lib.ImportPETSc(arch)
>     >       File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/lib/__init__.py", line 29, in ImportPETSc
>     >         return Import('petsc4py', 'PETSc', path, arch)
>     >       File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/lib/__init__.py", line 63, in Import
>     >         fo, fn, stuff = imp.find_module(name, pathlist)
>     >     ImportError: No module named PETSc
>     >
>     >
>     >     Anyone having an idea what could be the problem here?
>     >
>     >
>     > Is your PETSC_ARCH correct?
> 
>     I think so:
> 
>     % ls $PETSC_DIR/$PETSC_ARCH
>     bin  CMakeCache.txt  CMakeFiles  cmake_install.cmake  externalpackages  include  initial_cache_file.cmake  lib  Makefile
>      obj  share
> 
>     % echo $PETSC_DIR
>     /home/florian/software/petsc
> 
>     % echo $PETSC_ARCH
>     arch-linux2-c-debug
> 
> 
> For Python import, its either the module, or the path. Can you cd down to PETSc.so and import it directly?

Not really sure what you mean.


I tried to symlink "PETSc.so" to "PETSc.cpython-36m-x86_64-linux-gnu.so" to in
./petsc/arch-linux2-c-debug/lib/petsc4py/lib/arch-linux2-c-debug. That changed the error message to:

Traceback (most recent call last):
  File "RBF_Load.py", line 11, in <module>
    petsc4py.init(sys.argv)
  File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/__init__.py", line 42, in init
    PETSc = petsc4py.lib.ImportPETSc(arch)
  File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/lib/__init__.py", line 29, in ImportPETSc
    return Import('petsc4py', 'PETSc', path, arch)
  File "/home/florian/software/petsc/arch-linux2-c-debug/lib/petsc4py/lib/__init__.py", line 64, in Import
    module = imp.load_module(fullname, fo, fn, stuff)
ImportError: dynamic module does not define init function (initPETSc)

Is there another PETSc.so that should exist? Because there exists none, just the symlink I created.

Best,
Florian


More information about the petsc-users mailing list