[petsc-users] problems with petsc4py on M1 mac when configuring PETSc

Pierre Jolivet pierre at joliv.et
Fri Apr 8 05:06:04 CDT 2022


Cannot reproduce this locally.
$ ./configure --with-cc=gcc --with-cxx=g++ --with-petsc4py=1 --with-fc=gfortran --download-mpich --download-fblaslapack PETSC_DIR=`pwd` 
[…]
=====================================
To use petsc4py, add /tmp/petsc/arch-darwin-c-debug/lib to PYTHONPATH
=====================================
=========================================
Now to check if the libraries are working do:
make PETSC_DIR=/tmp/petsc PETSC_ARCH=arch-darwin-c-debug check
=========================================

Probably you have an outdated brew installation, or there is something in your PATH making things harder than they need to be.
Please send your configure.log to petsc-maint at mcs.anl.gov <mailto:petsc-maint at mcs.anl.gov>

Thanks,
Pierre

> On 8 Apr 2022, at 11:42 AM, Veronika Ulanova <19veronika97 at gmail.com> wrote:
> 
> To get this error i run the following commands:
> 
> 1. 
> ➜  petsc git:(release) ✗ ./configure --with-cc=gcc --with-cxx=g++ --with-petsc4py=1 --with-fc=gfortran --download-mpich --download-fblaslapack
> ➜  petsc git:(release) ✗    make PETSC_DIR=/Users/veronikaulanova/Documents/documents/Oxford_work/petsc PETSC_ARCH=arch-darwin-c-debug all    
> 
> On Fri, Apr 8, 2022 at 10:41 AM Veronika Ulanova <19veronika97 at gmail.com <mailto:19veronika97 at gmail.com>> wrote:
> I pulled the updated repo but now I get a different error also related to architecture:
> 
> ld: file not found: @rpath/libgcc_s.1.1.dylib for architecture arm64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> error: command '/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/bin/mpicc' failed with exit code 1
> **************************ERROR*************************************
> Error building petsc4py.
> ********************************************************************
> make[2]: *** [petsc4pybuild] Error 1
> **************************ERROR*************************************
>   Error during compile, check arch-darwin-c-debug/lib/petsc/conf/make.log
>   Send it and arch-darwin-c-debug/lib/petsc/conf/configure.log to petsc-maint at mcs.anl.gov <mailto:petsc-maint at mcs.anl.gov>
> ********************************************************************
> 
> Any idea about this one? Thank you
> 
> On Fri, Apr 8, 2022 at 10:09 AM Veronika Ulanova <19veronika97 at gmail.com <mailto:19veronika97 at gmail.com>> wrote:
> Hello Satish,
> 
> By the repo you mean the main PETSc repository?
> 
> Thank you, Veronika
> 
> On Fri, Apr 8, 2022 at 9:49 AM Satish Balay <balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>> wrote:
> A fix for M1 was recently pushed to the git repo.
> 
> Can you try using it [with either release or main branches] - and see if that works?
> 
> Satish
> 
> 
> 
> On Fri, 8 Apr 2022, Veronika Ulanova wrote:
> 
> > Hi,
> > 
> > I have been trying to configure the petsc4py package along with my PETSc
> > installation for my research. I have searched for solutions on the internet
> > but there was no luck, this is the error I get when I am trying to
> > configure PETSC and use it to run examples of code that utilise the
> > petsc4py package...
> > 
> > 
> > 
> >  File
> > "/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/PETSc.py",
> > line 3, in <module>
> > 
> >     PETSc = ImportPETSc(ARCH)
> > 
> >   File
> > "/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/__init__.py",
> > line 29, in ImportPETSc
> > 
> >     return Import('petsc4py', 'PETSc', path, arch)
> > 
> >   File
> > "/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/__init__.py",
> > line 73, in Import
> > 
> >     module = import_module(pkg, name, path, arch)
> > 
> >   File
> > "/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/__init__.py",
> > line 58, in import_module
> > 
> >     with f: return imp.load_module(fullname, f, fn, info)
> > 
> >   File "/opt/homebrew/Cellar/python at 3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py",
> > line 242, in load_module
> > 
> >     return load_dynamic(name, filename, file)
> > 
> >   File "/opt/homebrew/Cellar/python at 3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/imp.py",
> > line 342, in load_dynamic
> > 
> >     return _load(spec)
> > 
> > ImportError:
> > dlopen(/Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/arch-darwin-c-debug/
> > PETSc.cpython-39-darwin.so <http://petsc.cpython-39-darwin.so/> <http://petsc.cpython-39-darwin.so/ <http://petsc.cpython-39-darwin.so/>>, 2): no
> > suitable image found.  Did find:
> > 
> > /Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/arch-darwin-c-debug/
> > PETSc.cpython-39-darwin.so <http://petsc.cpython-39-darwin.so/> <http://petsc.cpython-39-darwin.so/ <http://petsc.cpython-39-darwin.so/>>: mach-o,
> > but wrong architecture
> > 
> > /Users/veronikaulanova/Documents/documents/Oxford_work/petsc/arch-darwin-c-debug/lib/petsc4py/lib/arch-darwin-c-debug/
> > PETSc.cpython-39-darwin.so <http://petsc.cpython-39-darwin.so/> <http://petsc.cpython-39-darwin.so/ <http://petsc.cpython-39-darwin.so/>>: stat()
> > failed with errno=25
> > 
> > 
> > As you can see I am using an M1 mac and therefore that causes the petsc4py
> > package to give me an error (highlighted above), but do you have any idea
> > of how I can solve it or why it is even there? I know that the new M1 has a
> > different architecture to intel macs but I have no idea of where to
> > start with fixing this or how to make it work. Any help would be much
> > appreciated, thank you in advance.
> > 
> > Kind Regards, Veronika
> > 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220408/45303431/attachment.html>


More information about the petsc-users mailing list