I cannot install petsc4py
in my Anaconda environment using pip
.
Installing with conda
doesn't work because it won't check my predefined PETSC_DIR and PETSC_ARCH environment variables during installation. numpy
and cython
are installed.
The error output by pip install
is shown in section IV, below.
I have Ananconda 2020.02, installed with Python 3.7. My OS is Ubuntu 18.04.
Configured using
--prefix="/home/$USER/.openmpi" CC=gcc FC=gfortran
Then make
and make install
.
Add .openmpi/bin
file to PATH and add .openmpi/lib
to LD_LIBRARY_PATH:
export PATH=/home/$USER/.openmpi/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/$USER/.openmpi/lib/
Configured indicating mpicc
and mpifort
from /home/$USER/.openmpi/bin
and downloading blas/lapack, scalapack, MUMPS, METIS, PARMETIS and PTSCOTCH, with -O2 compiler optimization (Note: I used MKL for blas/lapack and scalapack). Also indicate PETSC_DIR
folder location and PETSC_ARCH
name in ./configure
. I chose the option of no C++ compilers.
Then make all
and make check
. I also did a make test
, which took quite a while. There were no failures, only success, skip and to do.
export
PETSC_DIR
and PETSC_ARCH
(important for pets4py
).
mpi4py
using pip
I installed this using pip
, because mpi4py
cannot be installed using conda
while indicating a custom mpicc path, according to the answer to my question provided by Iliev in this link in Stack Overflow.
petsc4py
using pip
I wrote using --no-cache-dir:
pip install --no-cache-dir petsc4py
The build failed. The information displayed in the terminal is shown in the next section.
The errors are shown below.
(Bonus meta question: is there a way to set automatic line break in the code fences in Stack Overflow?)
Collecting petsc4py
Downloading petsc4py-3.12.0.tar.gz (1.8 MB)
|████████████████████████████████| 1.8 MB 2.8 MB/s
Requirement already satisfied: numpy in ./anaconda3/lib/python3.7/site-packages (from petsc4py) (1.18.1)
Building wheels for collected packages: petsc4py
Building wheel for petsc4py (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-khk8pv9d
cwd: /tmp/pip-install-5qdqmoex/petsc4py/
Complete output (97 lines):
running bdist_wheel
running build
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/petsc4py
copying src/PETSc.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__main__.py -> build/lib.linux-x86_64-3.7/petsc4py
creating build/lib.linux-x86_64-3.7/petsc4py/lib
copying src/lib/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py/lib
creating build/lib.linux-x86_64-3.7/petsc4py/include
creating build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc_api.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/numpy.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.i -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pyx -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py
copying src/lib/petsc.cfg -> build/lib.linux-x86_64-3.7/petsc4py/lib
running build_ext
PETSC_DIR: /home/breno/Documents/petsc
PETSC_ARCH: MUMPS-mkl-real-opt
version: 3.13.0 release
integer-size: 32-bit
scalar-type: real
precision: double
language: CONLY
compiler: /home/breno/.openmpi/bin/mpicc
linker: /home/breno/.openmpi/bin/mpicc
building 'PETSc' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src
/home/breno/.openmpi/bin/mpicc -pthread -B /home/breno/anaconda3/compiler_compat -Wl,--sysroot=/ -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -O2 -march=native -mtune=native -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/breno/Documents/petsc/MUMPS-mkl-real-opt/include -I/home/breno/Documents/petsc/include -Isrc/include -I/home/breno/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/breno/anaconda3/include/python3.7m -c src/PETSc.c -o build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src/PETSc.o
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Sys_28infoAllow’:
src/petsc4py.PETSc.c:65427:47: error: too many arguments to function ‘PetscInfoAllow’
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInfoAllow(__pyx_v_tval, NULL)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(27, 163, __pyx_L1_error)
^~~~~~~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petscsys.h:1474:0,
from /home/breno/Documents/petsc/include/petscbag.h:4,
from /home/breno/Documents/petsc/include/petsc.h:5,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petsclog.h:56:29: note: declared here
PETSC_EXTERN PetscErrorCode PetscInfoAllow(PetscBool);
^~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_304matMultSymbolic’:
src/petsc4py.PETSc.c:148044:47: warning: implicit declaration of function ‘MatMatMultSymbolic’; did you mean ‘MatProductSymbolic’? [-Wimplicit-function-declaration]
__pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(36, 1309, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~
MatProductSymbolic
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_306matMultNumeric’:
src/petsc4py.PETSc.c:148235:47: warning: implicit declaration of function ‘MatMatMultNumeric’; did you mean ‘MatProductNumeric’? [-Wimplicit-function-declaration]
__pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultNumeric(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_result->mat)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(36, 1317, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MatProductNumeric
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_6DMStag_54get1DCoordinateLocationSlot’:
src/petsc4py.PETSc.c:265960:3: warning: ‘DMStagGet1dCoordinateLocationSlot’ is deprecated [-Wdeprecated-declarations]
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMStagGet1dCoordinateLocationSlot(__pyx_v_self->__pyx_base.dm, __pyx_v_sloc, (&__pyx_v_slot))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(47, 274, __pyx_L1_error)
^~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petsc.h:22:0,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petscdmstag.h:127:130: note: declared here
PETSC_DEPRECATED_FUNCTION("Use DMStagGetProductCoordinateLocationSlot() (since version 3.13") PETSC_STATIC_INLINE PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt *s) {return DMStagGetProductCoordinateLocationSlot(dm,loc,s);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pymod_exec_PETSc’:
src/petsc4py.PETSc.c:309773:43: error: ‘MATLMVMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBROYDEN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 78, __pyx_L1_error)
^~~~~~~~~~~
MATLMVMBROYDEN
src/petsc4py.PETSc.c:309773:43: note: each undeclared identifier is reported only once for each function it appears in
src/petsc4py.PETSc.c:309785:43: error: ‘MATLMVMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 79, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBRDN
src/petsc4py.PETSc.c:309797:43: error: ‘MATLMVMSYMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 80, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBADBRDN
src/petsc4py.PETSc.c:309809:43: error: ‘MATLMVMSYMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMSYMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 81, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MATLMVMSYMBRDN
src/petsc4py.PETSc.c:309821:43: error: ‘MATLMVMDIAGBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMDIAGBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 82, __pyx_L1_error)
^~~~~~~~~~~~~~~
MATLMVMBADBRDN
error: command '/home/breno/.openmpi/bin/mpicc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for petsc4py
Running setup.py clean for petsc4py
Failed to build petsc4py
Installing collected packages: petsc4py
Running setup.py install for petsc4py ... error
ERROR: Command errored out with exit status 1:
command: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_npojm20/install-record.txt --single-version-externally-managed --compile --install-headers /home/breno/anaconda3/include/python3.7m/petsc4py
cwd: /tmp/pip-install-5qdqmoex/petsc4py/
Complete output (97 lines):
running install
running build
running build_src
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/petsc4py
copying src/PETSc.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py
copying src/__main__.py -> build/lib.linux-x86_64-3.7/petsc4py
creating build/lib.linux-x86_64-3.7/petsc4py/lib
copying src/lib/__init__.py -> build/lib.linux-x86_64-3.7/petsc4py/lib
creating build/lib.linux-x86_64-3.7/petsc4py/include
creating build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc_api.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.PETSc.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/numpy.h -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/petsc4py.i -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pxd -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/include/petsc4py/__init__.pyx -> build/lib.linux-x86_64-3.7/petsc4py/include/petsc4py
copying src/PETSc.pxd -> build/lib.linux-x86_64-3.7/petsc4py
copying src/lib/petsc.cfg -> build/lib.linux-x86_64-3.7/petsc4py/lib
running build_ext
PETSC_DIR: /home/breno/Documents/petsc
PETSC_ARCH: MUMPS-mkl-real-opt
version: 3.13.0 release
integer-size: 32-bit
scalar-type: real
precision: double
language: CONLY
compiler: /home/breno/.openmpi/bin/mpicc
linker: /home/breno/.openmpi/bin/mpicc
building 'PETSc' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt
creating build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src
/home/breno/.openmpi/bin/mpicc -pthread -B /home/breno/anaconda3/compiler_compat -Wl,--sysroot=/ -fPIC -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -O2 -march=native -mtune=native -fPIC -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/breno/Documents/petsc/MUMPS-mkl-real-opt/include -I/home/breno/Documents/petsc/include -Isrc/include -I/home/breno/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/breno/anaconda3/include/python3.7m -c src/PETSc.c -o build/temp.linux-x86_64-3.7/MUMPS-mkl-real-opt/src/PETSc.o
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Sys_28infoAllow’:
src/petsc4py.PETSc.c:65427:47: error: too many arguments to function ‘PetscInfoAllow’
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(PetscInfoAllow(__pyx_v_tval, NULL)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(27, 163, __pyx_L1_error)
^~~~~~~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petscsys.h:1474:0,
from /home/breno/Documents/petsc/include/petscbag.h:4,
from /home/breno/Documents/petsc/include/petsc.h:5,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petsclog.h:56:29: note: declared here
PETSC_EXTERN PetscErrorCode PetscInfoAllow(PetscBool);
^~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_304matMultSymbolic’:
src/petsc4py.PETSc.c:148044:47: warning: implicit declaration of function ‘MatMatMultSymbolic’; did you mean ‘MatProductSymbolic’? [-Wimplicit-function-declaration]
__pyx_t_5 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultSymbolic(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_rval, (&__pyx_v_result->mat))); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(36, 1309, __pyx_L1_error)
^~~~~~~~~~~~~~~~~~
MatProductSymbolic
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_3Mat_306matMultNumeric’:
src/petsc4py.PETSc.c:148235:47: warning: implicit declaration of function ‘MatMatMultNumeric’; did you mean ‘MatProductNumeric’? [-Wimplicit-function-declaration]
__pyx_t_4 = __pyx_f_8petsc4py_5PETSc_CHKERR(MatMatMultNumeric(__pyx_v_self->mat, __pyx_v_mat->mat, __pyx_v_result->mat)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(36, 1317, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MatProductNumeric
src/petsc4py.PETSc.c: In function ‘__pyx_pf_8petsc4py_5PETSc_6DMStag_54get1DCoordinateLocationSlot’:
src/petsc4py.PETSc.c:265960:3: warning: ‘DMStagGet1dCoordinateLocationSlot’ is deprecated [-Wdeprecated-declarations]
__pyx_t_2 = __pyx_f_8petsc4py_5PETSc_CHKERR(DMStagGet1dCoordinateLocationSlot(__pyx_v_self->__pyx_base.dm, __pyx_v_sloc, (&__pyx_v_slot))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(47, 274, __pyx_L1_error)
^~~~~~~~~
In file included from /home/breno/Documents/petsc/include/petsc.h:22:0,
from src/petsc4py.PETSc.c:596,
from src/PETSc.c:4:
/home/breno/Documents/petsc/include/petscdmstag.h:127:130: note: declared here
PETSC_DEPRECATED_FUNCTION("Use DMStagGetProductCoordinateLocationSlot() (since version 3.13") PETSC_STATIC_INLINE PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt *s) {return DMStagGetProductCoordinateLocationSlot(dm,loc,s);}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/PETSc.c:4:0:
src/petsc4py.PETSc.c: In function ‘__pyx_pymod_exec_PETSc’:
src/petsc4py.PETSc.c:309773:43: error: ‘MATLMVMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBROYDEN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 78, __pyx_L1_error)
^~~~~~~~~~~
MATLMVMBROYDEN
src/petsc4py.PETSc.c:309773:43: note: each undeclared identifier is reported only once for each function it appears in
src/petsc4py.PETSc.c:309785:43: error: ‘MATLMVMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 79, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBRDN
src/petsc4py.PETSc.c:309797:43: error: ‘MATLMVMSYMBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 80, __pyx_L1_error)
^~~~~~~~~~~~~~
MATLMVMBADBRDN
src/petsc4py.PETSc.c:309809:43: error: ‘MATLMVMSYMBADBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMSYMBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMSYMBADBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 81, __pyx_L1_error)
^~~~~~~~~~~~~~~~~
MATLMVMSYMBRDN
src/petsc4py.PETSc.c:309821:43: error: ‘MATLMVMDIAGBRDN’ undeclared (first use in this function); did you mean ‘MATLMVMBADBRDN’?
__pyx_t_7 = __pyx_f_8petsc4py_5PETSc_S_(MATLMVMDIAGBRDN); if (unlikely(!__pyx_t_7)) __PYX_ERR(36, 82, __pyx_L1_error)
^~~~~~~~~~~~~~~
MATLMVMBADBRDN
error: command '/home/breno/.openmpi/bin/mpicc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/breno/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5qdqmoex/petsc4py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_npojm20/install-record.txt --single-version-externally-managed --compile --install-headers /home/breno/anaconda3/include/python3.7m/petsc4py Check the logs for full command output.
I was trying to install petsc4py
with the then latest released version 3.12.0 while having installed and configured PETSc version 3.13.0. This now seems quite obvious that it wouldn't work, but there wasn't a clear mention of this in the documentation.
You can either install the none-released version using pip install https://bitbucket.org/petsc/petsc4py/issues/137/error-installing-in-anaconda-environment
OR wait for it to be released officially!
Make sure that your version of PETSc is the same as petsc4py
!