[petsc-users] petsc4py installation error with PETSc v 3.6.1

Satish Balay balay at mcs.anl.gov
Wed Jul 22 18:26:19 CDT 2015


The attached patch to petsc4py should fix the error.

Satish

On Wed, 22 Jul 2015, Justin Chang wrote:

> Hi all,
> 
> Just installed the latest petsc-dev, and when I tried to build petsc4py via
> git clone ... and pip setup.py build  i get the following errors:
> 
> ====
> 
> running build
> 
> running build_src
> 
> cythonizing 'petsc4py.PETSc.pyx' -> 'petsc4py.PETSc.c'
> 
> cythonizing 'libpetsc4py/libpetsc4py.pyx' -> 'libpetsc4py/libpetsc4py.c'
> 
> running build_py
> 
> creating build
> 
> creating build/lib.linux-x86_64-2.7
> 
> creating build/lib.linux-x86_64-2.7/petsc4py
> 
> copying src/PETSc.py -> build/lib.linux-x86_64-2.7/petsc4py
> 
> copying src/__init__.py -> build/lib.linux-x86_64-2.7/petsc4py
> 
> copying src/__main__.py -> build/lib.linux-x86_64-2.7/petsc4py
> 
> creating build/lib.linux-x86_64-2.7/petsc4py/lib
> 
> copying src/lib/__init__.py -> build/lib.linux-x86_64-2.7/petsc4py/lib
> 
> creating build/lib.linux-x86_64-2.7/petsc4py/include
> 
> creating build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/numpy.h ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/petsc4py.h ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/petsc4py.PETSc.h ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/petsc4py.PETSc_api.h ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/petsc4py.i ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/PETSc.pxd ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/__init__.pxd ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/include/petsc4py/__init__.pyx ->
> build/lib.linux-x86_64-2.7/petsc4py/include/petsc4py
> 
> copying src/lib/petsc.cfg -> build/lib.linux-x86_64-2.7/petsc4py/lib
> 
> running build_ext
> 
> PETSC_DIR:   /home/jchang23/petsc-dev
> 
> PETSC_ARCH:  arch-linux2-c-opt
> 
> version:     3.6.1 development
> 
> scalar-type: real
> 
> precision:   double
> 
> language:    CONLY
> 
> compiler:    /share/apps/openmpi-1.8.3/bin/mpicc
> 
> linker:      /share/apps/openmpi-1.8.3/bin/mpicc
> 
> building 'PETSc' extension
> 
> creating build/temp.linux-x86_64-2.7
> 
> creating build/temp.linux-x86_64-2.7/arch-linux2-c-opt
> 
> creating build/temp.linux-x86_64-2.7/arch-linux2-c-opt/src
> 
> /share/apps/openmpi-1.8.3/bin/mpicc -pthread -fPIC -O -fPIC
> -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
> -DPETSC_DIR=/home/jchang23/petsc-dev -I/share/apps/openmpi-1.8.3/include
> -I/home/jchang23/petsc-dev/arch-linux2-c-opt/include
> -I/home/jchang23/petsc-dev/include -Isrc/include
> -I/home/jchang23/.local/lib/python2.7/site-packages/numpy/core/include
> -I/home/jchang23/.local/include/python2.7 -c src/PETSc.c -o
> build/temp.linux-x86_64-2.7/arch-linux2-c-opt/src/PETSc.o
> 
> In file included from
> /home/jchang23/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1804:0,
> 
>                  from
> /home/jchang23/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
> 
>                  from
> /home/jchang23/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
> 
>                  from src/include/petsc4py/numpy.h:11,
> 
>                  from src/petsc4py.PETSc.c:258,
> 
>                  from src/PETSc.c:3:
> 
> /home/jchang23/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2:
> warning: #warning "Using deprecated NumPy API, disable it by " "#defining
> NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
> 
>  #warning "Using deprecated NumPy API, disable it by " \
> 
>   ^
> 
> In file included from src/PETSc.c:3:0:
> 
> src/petsc4py.PETSc.c: In function
> ‘__pyx_pf_8petsc4py_5PETSc_7Section_76createGlobalSection’:
> 
> src/petsc4py.PETSc.c:108243:47: error: incompatible type for argument 4 of
> ‘PetscSectionCreateGlobalSection’
> 
>    __pyx_t_2 =
> __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionCreateGlobalSection(__pyx_v_self->sec,
> __pyx_v_sf->sf, PETSC_FALSE, (&__pyx_v_gsec->sec))); if (unlikely(__pyx_t_2
> == -1)) {__pyx_filename = __pyx_f[32]; __pyx_lineno = 213; __pyx_clineno =
> __LINE__; goto __pyx_L1_error;}
> 
>                                                ^
> 
> In file included from /home/jchang23/petsc-dev/include/petscvec.h:9:0,
> 
>                  from /home/jchang23/petsc-dev/include/petscmat.h:6,
> 
>                  from /home/jchang23/petsc-dev/include/petscdm.h:6,
> 
>                  from /home/jchang23/petsc-dev/include/petscdmda.h:4,
> 
>                  from /home/jchang23/petsc-dev/include/petsc.h:12,
> 
>                  from src/petsc4py.PETSc.c:254,
> 
>                  from src/PETSc.c:3:
> 
> /home/jchang23/petsc-dev/include/petscis.h:334:29: note: expected
> ‘PetscBool’ but argument is of type ‘struct _p_PetscSection **’
> 
>  PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSection(PetscSection,
> PetscSF, PetscBool, PetscBool, PetscSection *);
> 
>                              ^
> 
> In file included from src/PETSc.c:3:0:
> 
> src/petsc4py.PETSc.c:108243:47: error: too few arguments to function
> ‘PetscSectionCreateGlobalSection’
> 
>    __pyx_t_2 =
> __pyx_f_8petsc4py_5PETSc_CHKERR(PetscSectionCreateGlobalSection(__pyx_v_self->sec,
> __pyx_v_sf->sf, PETSC_FALSE, (&__pyx_v_gsec->sec))); if (unlikely(__pyx_t_2
> == -1)) {__pyx_filename = __pyx_f[32]; __pyx_lineno = 213; __pyx_clineno =
> __LINE__; goto __pyx_L1_error;}
> 
>                                                ^
> 
> In file included from /home/jchang23/petsc-dev/include/petscvec.h:9:0,
> 
>                  from /home/jchang23/petsc-dev/include/petscmat.h:6,
> 
>                  from /home/jchang23/petsc-dev/include/petscdm.h:6,
> 
>                  from /home/jchang23/petsc-dev/include/petscdmda.h:4,
> 
>                  from /home/jchang23/petsc-dev/include/petsc.h:12,
> 
>                  from src/petsc4py.PETSc.c:254,
> 
>                  from src/PETSc.c:3:
> 
> /home/jchang23/petsc-dev/include/petscis.h:334:29: note: declared here
> 
>  PETSC_EXTERN PetscErrorCode PetscSectionCreateGlobalSection(PetscSection,
> PetscSF, PetscBool, PetscBool, PetscSection *);
> 
> error: command '/share/apps/openmpi-1.8.3/bin/mpicc' failed with exit
> status 1
> 
> 
> =========
> 
> I am guessing it's because PetscSectionCreateGlobalSection has changed in
> this latest released. Is there a way to fix this?
> 
> Thanks,
> 
> Justin
> 
-------------- next part --------------
diff --git a/src/PETSc/Section.pyx b/src/PETSc/Section.pyx
index 8064b4a..a78b5e4 100644
--- a/src/PETSc/Section.pyx
+++ b/src/PETSc/Section.pyx
@@ -210,5 +210,5 @@ cdef class Section(Object):
 
     def createGlobalSection(self, SF sf not None):
         cdef Section gsec = Section()
-        CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,&gsec.sec) )
+        CHKERR( PetscSectionCreateGlobalSection(self.sec,sf.sf,PETSC_FALSE,PETSC_FALSE,&gsec.sec) )
         return gsec
diff --git a/src/PETSc/petscsec.pxi b/src/PETSc/petscsec.pxi
index acaba9c..d5a88d2 100644
--- a/src/PETSc/petscsec.pxi
+++ b/src/PETSc/petscsec.pxi
@@ -45,7 +45,7 @@ cdef extern from * nogil:
     int PetscSectionGetFieldOffset(PetscSection,PetscInt,PetscInt,PetscInt*)
     int PetscSectionSetFieldOffset(PetscSection,PetscInt,PetscInt,PetscInt)
     int PetscSectionGetOffsetRange(PetscSection,PetscInt*,PetscInt*)
-    int PetscSectionCreateGlobalSection(PetscSection,PetscSF,PetscBool,PetscSection*)
+    int PetscSectionCreateGlobalSection(PetscSection,PetscSF,PetscBool,PetscBool,PetscSection*)
     #int PetscSectionCreateGlobalSectionCensored(PetscSection,PetscSF,PetscBool,PetscInt,const_PetscInt[],PetscSection*)
     int PetscSectionCreateSubsection(PetscSection,PetscInt,PetscInt[],PetscSection*)
     int PetscSectionCreateSubmeshSection(PetscSection,IS,PetscSection*)


More information about the petsc-users mailing list