- edited description
File "PETSc/Vec.pyx", line 144, in petsc4py.PETSc.Vec.create petsc4py.PETSc.Error: error code 1
When running the test code (attached) the following error message appears. I use 4.6.3 with Python version 3.7.1 I have installed petsc4py version 3.10.1 using pip after installing petsc version 3.10.3
(base) bash-3.2$ python3 test_blmvm.py
Traceback (most recent call last):
File "test_blmvm.py", line 44, in <module>
x = PETSc.Vec().create(tao_comm)
File "PETSc/Vec.pyx", line 144, in petsc4py.PETSc.Vec.create
petsc4py.PETSc.Error: error code 1
[0] VecCreate() line 35 in /Users/____/Applications/petsc-3.10.3/src/vec/vec/interface/veccreate.c
[0] PetscHeaderCreate_Private() line 64 in /Users/____/Applications/petsc-3.10.3/src/sys/objects/inherit.c
[0] PetscCommDuplicate() line 132 in /Users/____/Applications/petsc-3.10.3/src/sys/objects/tagm.c
(base) bash-3.2$
I thank you in advance for your help on this.
Comments (10)
-
-
What MPI are you using? And you run "ldd /path/to/petsc4py/lib/PETSc.so" and check it is linked to the right PETSc and MPI libraries? I cannot reproduce the issue using petsc/master and both python2/python3. My guess is something is wrong in your side, I tested on Linux, and it seems you are on macOS (are you using homebrew?).
-
reporter Dear Lisandro,
Thank you very much for your reply.
I am using MPICH (with macOS). I did not install using homebrew.
(base) bash-3.2$ otool -L /Users/____/Applications/petsc4py-3.10.1/build/lib.macosx-10.7-x86_64-3.7/petsc4py/lib/arch-darwin-c-debug/PETSc.cpython-37m-darwin.so /Users/____/Applications/petsc4py-3.10.1/build/lib.macosx-10.7-x86_64-3.7/petsc4py/lib/arch-darwin-c-debug/PETSc.cpython-37m-darwin.so: /Users/____/Applications/petsc-3.10.3/arch-darwin-c-debug/lib/libpetsc.3.10.dylib (compatibility version 3.10.0, current version 3.10.3) /Users/____/Applications/mpich-install/lib/libmpi.12.dylib (compatibility version 14.0.0, current version 14.6.0) /Users/yaoki/Applications/mpich-install/lib/libpmpi.12.dylib (compatibility version 14.0.0, current version 14.6.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
is what I got following your suggestion. So can it be possible the MPICH I have installed is not a compatible (too old) version? (bit strange as I have downloaded it last week..)
-
reporter - edited description
-
Mmm... are you sure the installed petsc4py (the on you get if you
import petsc4py
in Python code) is the one you ranotool
on? Any chance you have a badPYTHONPATH
? Why are you running petsc4py from its build directory? Why don't you justpip install --user petsc4py
? -
reporter Thank you very much for the reply.
my apology, probably this is more like what we were after...
(base) bash-3.2$ otool -L /anaconda3/lib/python3.7/site-packages/petsc4py/lib/arch-darwin-c-debug/PETSc.cpython-37m-darwin.so /anaconda3/lib/python3.7/site-packages/petsc4py/lib/arch-darwin-c-debug/PETSc.cpython-37m-darwin.so: /Users/yaoki/Applications/petsc-3.10.3/arch-darwin-c-debug/lib/libpetsc.3.10.dylib (compatibility version 3.10.0, current version 3.10.3) /Users/____/Applications/petsc-3.10.3/arch-darwin-c-debug/lib/libmpi.0.dylib (compatibility version 1.0.0, current version 1.0.0) /Users/____/Applications/petsc-3.10.3/arch-darwin-c-debug/lib/libpmpi.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
-
Oh, so you are using PETSc and petsc4py from conda-forge, too! So you have some anaconda install with PETSc and MPI (Open MPI or MPICH?) in
/anaconda3
, and then you have some other installations in~/Applications
of MPICH and PETSc. At this point I have no clue how you installed petsc4py with pip (and where that install went), or if you are using petsc4py from conda-forge. You have to start clean, review yourPYTHONPATH
variable, make sure yourPETSc_DIR
variable points to the right PETSc you want to use, then you canpip install petsc4py
if you really want (otherwise use the conda-forge petsc4py package!). After all that, youimport petsc4py; print(petsc4py)
in a Python prompt to make sure you are loading what you expect. If not, you still have some mess around. -
reporter Dear Lisandro, Thank you very much for the detailed suggestion. I will try to follow that to see what will happen.
-
Can I close this issue?
-
- changed status to closed
- Log in to comment