I am following the precice tutorial, and got an error I cannot resolve:
When I “import precice” in python, I get the following error:
~/Downloads/part1/skeleton/generator$ python3 generator.py
Traceback (most recent call last):
File “/Users/weinhartt/Downloads/part1/skeleton/generator/generator.py”, line 3, in
import precice
File “/Users/weinhartt/Library/Python/3.9/lib/python/site-packages/precice/init.py”, line 3, in
from cyprecice import Interface, action_read_iteration_checkpoint, action_write_iteration_checkpoint, action_write_initial_data, get_version_information
ImportError: dlopen(/Users/weinhartt/Library/Python/3.9/lib/python/site-packages/cyprecice.cpython-39-darwin.so, 2): Symbol not found: __ZN5boost15program_options19options_description21m_default_line_lengthE
Referenced from: /Users/weinhartt/Library/Python/3.9/lib/python/site-packages/cyprecice.cpython-39-darwin.so
Expected in: flat namespace
in /Users/weinhartt/Library/Python/3.9/lib/python/site-packages/cyprecice.cpython-39-darwin.so
I am using MacOS Big Sur, SDK 11.0, python 3.9. I have used brew to reinstall boost, petsc, openmpi, then I installed precice and pyprecice, without errors or warning, see below.
Any help is appreciated.
~$ brew reinstall boost
==> Downloading https://homebrew.bintray.com/bottles/boost-1.75.0_1.big_sur.bottle.tar.gz
Already downloaded: /Users/weinhartt/Library/Caches/Homebrew/downloads/f3136c231545902ba78c4f23a11c4c54cb25503b0621f752eaff050864696ad4–boost-1.75.0_1.big_sur.bottle.tar.gz
==> Reinstalling boost
==> Pouring boost-1.75.0_1.big_sur.bottle.tar.gz
/usr/local/Cellar/boost/1.75.0_1: 15,058 files, 524.2MB
~/Code/precice-2.2.0/build$ cmake . -DPRECICE_PETScMapping=OFF && make && make install
– === CONFIGURATION ===
– Library version to build: 2.2.0
– Build configuration: Debug
– Build shared libraries: OFF
– Target system: Darwin-20.3.0
– Host system: Darwin-20.3.0
– Library architecture:
– CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
– CXX compiler flags:
– CXX linker: /Library/Developer/CommandLineTools/usr/bin/ld
– Install prefix: /usr/local
– Source directory: /Users/weinhartt/Code/precice-2.2.0
– Binary directory: /Users/weinhartt/Code/precice-2.2.0/build
– Configure package generation: ON
– Install tests/testfiles: OFF
– Additional CTest MPI Flags:– === ENABLED FEATURES ===
MPICommunication, Enables the MPI communication back-end.
This enables the MPI communication back-end which is highly recommended on multi-node systems.
See the documentation of the CMake module FindMPI to control its functionality.This feature can be enabled/disabled by setting the PRECICE_MPICommunication CMake option.
PythonActions, Enables the support for user-defined python actions.
preCICE allows to manipulate coupling data at runtime using configurable actions.
This feature enables the support for user-defined actions written in Python based on numpy.This feature can be enabled/disabled by setting the PRECICE_PythonActions CMake option.
CBindings, Enables the native C bindings.
preCICE provides native bindings for C, which are compiled into the library.
This feature enables the compilation and installation of the bindings into the library.
Note that we strongly recommend to compile with C bindings enabled for compatibility reasons.This feature can be enabled/disabled by setting the PRECICE_ENABLE_C CMake option.
FortranBindings, Enables the native Fortran bindings.
preCICE provides native bindings for Fortran, which are compiled into the library.
This feature enables the compilation and installation of the bindings into the library.
Note that we strongly recommend to compile with Fortran bindings enabled for compatibility reasons.This feature can be enabled/disabled by setting the PRECICE_ENABLE_FORTRAN CMake option.
– === DISABLED FEATURES ===
PETScMapping, Enables the PETSc-powered radial basic function mappings.
This enables the PETSc-based variant of radial basis function mappings which can run in parallel,
also across different compute nodes. This is highly recommended for large cases running in parallel.This feature can be enabled/disabled by setting the PRECICE_PETScMapping CMake option.
Requires MPICommunication.– === DEPENDENCIES ===
– Validating Eigen
– Validating Prettyprint - success [cached]
– Validating LibXml2
– Validating Prettyprint - success [cached]
– Validating JSON
– Validating Prettyprint - success [cached]
– Validating Prettyprint
– Validating Prettyprint - success [cached]
– MPI Version: Open MPI v4.0.5, package: Open MPI brew@BigSur Distribution, ident: 4.0.5, repo rev: v4.0.5, Aug 26, 2020
– PETSc support disabled
– Validating LibPython
– Validating Prettyprint - success [cached]
– Validating NumPy
– Validating Prettyprint - success [cached]– === TARGETS & PACKAGES ===
– Including test sources
– Compressing manpage: /Users/weinhartt/Code/precice-2.2.0/build/packaging/man1/binprecice.1
Debian package generator disabled: Install prefix is not “/usr”
– Compressing changelog– === TESTS ===
– Test precice.acceleration
– Test precice.action
– Test precice.com
– Test precice.com.mpiports - skipped (OpenMPI)
– Test precice.cplscheme
– Test precice.io
– Test precice.m2n
– Test precice.m2n.mpiports - skipped (OpenMPI)
– Test precice.mapping
– Test precice.mapping.petrbf - skipped
– Test precice.math
– Test precice.mesh
– Test precice.partition
– Test precice.interface
– Test precice.serial
– Test precice.parallel
– Test precice.query
– Test precice.testing
– Test precice.utils
– Test precice.xml
– Test precice.solverdummy.build.cpp
– Test precice.solverdummy.build.c
– Test precice.solverdummy.build.fortran
– Test precice.solverdummy.run.cpp-cpp
– Test precice.solverdummy.run.c-c
– Test precice.solverdummy.run.fortran-fortran
– Test precice.solverdummy.run.cpp-c
– Test precice.solverdummy.run.cpp-fortran
– Test precice.solverdummy.run.c-fortran
– Configuring done
– Generating done
– Build files have been written to: /Users/weinhartt/Code/precice-2.2.0/build
– Found Git: /usr/local/bin/git (found version “2.30.0”)
– Revision status: Detection failed
[ 0%] Built target GitRevision
[ 62%] Built target precice
[ 99%] Built target testprecice
[100%] Built target binprecice
– Found Git: /usr/local/bin/git (found version “2.30.0”)
– Revision status: Detection failed
[ 0%] Built target GitRevision
[ 62%] Built target precice
[ 99%] Built target testprecice
[100%] Built target binprecice
Install the project…
– Install configuration: “Debug”
– Installing: /usr/local/lib/libprecice.a
– Up-to-date: /usr/local/include/precice/SolverInterface.hpp
– Up-to-date: /usr/local/include/precice/SolverInterfaceC.h
– Up-to-date: /usr/local/include/precice/SolverInterfaceFortran.hpp
– Up-to-date: /usr/local/include/precice/SolverInterfaceFASTEST.hpp
– Up-to-date: /usr/local/bin/binprecice
– Up-to-date: /usr/local/share/precice/examples
– Up-to-date: /usr/local/share/precice/examples/solverdummies
– Up-to-date: /usr/local/share/precice/examples/solverdummies/solverdummies.doxys
– Up-to-date: /usr/local/share/precice/examples/solverdummies/precice-config.xml
– Up-to-date: /usr/local/share/precice/examples/solverdummies/README.md
– Up-to-date: /usr/local/share/precice/examples/solverdummies/cpp
– Up-to-date: /usr/local/share/precice/examples/solverdummies/cpp/CMakeLists.txt
– Up-to-date: /usr/local/share/precice/examples/solverdummies/cpp/solverdummy.cpp
– Up-to-date: /usr/local/share/precice/examples/solverdummies/cpp/README.md
– Up-to-date: /usr/local/share/precice/examples/solverdummies/cpp/test.cmake
– Up-to-date: /usr/local/share/precice/examples/solverdummies/fortran
– Up-to-date: /usr/local/share/precice/examples/solverdummies/fortran/CMakeLists.txt
– Up-to-date: /usr/local/share/precice/examples/solverdummies/fortran/solverdummy.f90
– Up-to-date: /usr/local/share/precice/examples/solverdummies/fortran/README.md
– Up-to-date: /usr/local/share/precice/examples/solverdummies/c
– Up-to-date: /usr/local/share/precice/examples/solverdummies/c/CMakeLists.txt
– Up-to-date: /usr/local/share/precice/examples/solverdummies/c/README.md
– Up-to-date: /usr/local/share/precice/examples/solverdummies/c/solverdummy.c
– Up-to-date: /usr/local/lib/cmake/precice/preciceTargets.cmake
– Installing: /usr/local/lib/cmake/precice/preciceTargets-debug.cmake
– Up-to-date: /usr/local/lib/cmake/precice/preciceConfig.cmake
– Up-to-date: /usr/local/lib/cmake/precice/preciceConfigVersion.cmake
– Up-to-date: /usr/local/share/man/man1
– Up-to-date: /usr/local/share/man/man1/binprecice.1.gz
– Up-to-date: /usr/local/lib/pkgconfig
– Up-to-date: /usr/local/lib/pkgconfig/libprecice.pc
– Up-to-date: /usr/local/share/doc/libprecice2/copyright
– Installing: /usr/local/share/lintian/overrides/libprecice2
– Up-to-date: /usr/local/share/doc/libprecice2/changelog.gz
~/Code/python-bindings$ pip3 install --user .
Processing /Users/weinhartt/Code/python-bindings
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … done
Requirement already satisfied: numpy in /usr/local/lib/python3.9/site-packages (from pyprecice==2.2.0.1+7.g814db22) (1.20.1)
Requirement already satisfied: mpi4py in /usr/local/lib/python3.9/site-packages (from pyprecice==2.2.0.1+7.g814db22) (3.0.3)
Building wheels for collected packages: pyprecice
Building wheel for pyprecice (PEP 517) … done
Created wheel for pyprecice: filename=pyprecice-2.2.0.1+7.g814db22-py2.py3-none-any.whl size=5754537 sha256=d5f9312cf520c9de40b227075095167d703b1494456fb3cdf55883f5c3de84bc
Stored in directory: /Users/weinhartt/Library/Caches/pip/wheels/a5/25/a8/8ec92057b72c5269060559ab4701d89a98516ef2a129d3c978
Successfully built pyprecice
Installing collected packages: pyprecice
Attempting uninstall: pyprecice
Found existing installation: pyprecice 2.2.0.1+7.g814db22
Uninstalling pyprecice-2.2.0.1+7.g814db22:
Successfully uninstalled pyprecice-2.2.0.1+7.g814db22
Successfully installed pyprecice-2.2.0.1+7.g814db22