Problems with Installing Python Bindings

Hello I am trying to install the Python Bindings for Precice but when using pip install I get this big error

Collecting pyprecice==2.5.0.1rc1
Downloading pyprecice-2.5.0.1rc1.tar.gz (44 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.1/44.1 kB 926.9 kB/s eta 0:00:00
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Requirement already satisfied: numpy in /opt/python/3.9.0/gcc-11.3.0/lib/python3.9/site-packages (from pyprecice==2.5.0.1rc1) (1.23.5)
Requirement already satisfied: mpi4py in /opt/python/3.9.0/gcc-11.3.0/lib/python3.9/site-packages (from pyprecice==2.5.0.1rc1) (3.1.4)
Building wheels for collected packages: pyprecice
Building wheel for pyprecice (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for pyprecice (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [76 lines of output]
:11: UserWarning: It looks like you are not using pip for installation. Installing the package via ‘pip3 install --user .’ is recommended. You can still use ‘python3 setup.py install --user’, if you want and if the bindings work correctly, you do not have to worry. However, if you face problems during installation or running pyprecice, this means that you have to make sure that all dependencies are installed correctly and repeat the installation of pyprecice. Refer to pyproject.toml for a list of dependencies.
/tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/setuptools/dist.py:529: UserWarning: Normalizing ‘v2.5.0.1rc1’ to ‘2.5.0.1rc1’
warnings.warn(tmpl.format(locals()))
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/precice
copying precice/_version.py → build/lib/precice
copying precice/init.py → build/lib/precice
UPDATING build/lib/precice/_version.py
set build/lib/precice/_version.py to ‘v2.5.0.1rc1’
installing to build/bdist.linux-x86_64/wheel
running install
Compiling /tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.pyx because it changed.
[1/1] Cythonizing /tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.pyx
running install_lib
running build_ext
building ‘cyprecice’ extension
creating build/temp.linux-x86_64-cpython-39
creating build/temp.linux-x86_64-cpython-39/tmp
creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-hmoh00jl
creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c
creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice
/opt/gcc/11.3.0/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/opt/python/3.9.0/gcc-11.3.0/include -I/opt/python/3.9.0/gcc-11.3.0/include -fPIC -I/opt/python/3.9.0/gcc-11.3.0/include/python3.9 -c /tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp -o build/temp.linux-x86_64-cpython-39/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.o -std=c++11 -I/tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/numpy/core/include -I/usr/local/include
In file included from /tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1948,
from /tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5,
from /tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:783:
/tmp/pip-build-env-lrh09us8/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " “#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION” [-Wcpp]
17 | #warning "Using deprecated NumPy API, disable it with "
| ^~~~~~~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject
__pyx_pf_9cyprecice_9Interface_8initialize_data(__pyx_obj_9cyprecice_Interface
)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:3283:26: error: ‘class precice::SolverInterface’ has no member named ‘initializeData’; did you mean ‘initialize’?
3283 | __pyx_v_self->thisptr->initializeData();
| ^~~~~~~~~~~~~~
| initialize
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_18is_read_data_available(__pyx_obj_9cyprecice_Interface*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:3595:60: error: ‘class precice::SolverInterface’ has no member named ‘isReadDataAvailable’
3595 | __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->thisptr->isReadDataAvailable()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_20is_write_data_required(__pyx_obj_9cyprecice_Interface*, double)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:3672:60: error: ‘class precice::SolverInterface’ has no member named ‘isWriteDataRequired’; did you mean ‘isGradientDataRequired’?
3672 | __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->thisptr->isWriteDataRequired(__pyx_v_computed_timestep_length)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 272, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~
| isGradientDataRequired
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_24has_to_evaluate_surrogate_model(__pyx_obj_9cyprecice_Interface*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:3800:60: error: ‘class precice::SolverInterface’ has no member named ‘hasToEvaluateSurrogateModel’
3800 | __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->thisptr->hasToEvaluateSurrogateModel()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_26has_to_evaluate_fine_model(__pyx_obj_9cyprecice_Interface*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:3864:60: error: ‘class precice::SolverInterface’ has no member named ‘hasToEvaluateFineModel’
3864 | __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->thisptr->hasToEvaluateFineModel()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_36get_mesh_ids(__pyx_obj_9cyprecice_Interface*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:4193:76: warning: ‘std::set precice::SolverInterface::getMeshIDs() const’ is deprecated: Use getMeshID() for specific mesh names instead. [-Wdeprecated-declarations]
4193 | __pyx_t_1 = __pyx_convert_set_to_py_int(__pyx_v_self->thisptr->getMeshIDs()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
| ~^~
In file included from /tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:810:
/usr/local/include/precice/SolverInterface.hpp:291:84: note: declared here
291 | [[deprecated(“Use getMeshID() for specific mesh names instead.”)]] std::set getMeshIDs() const;
| ^
~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_66map_read_data_to(__pyx_obj_9cyprecice_Interface*, PyObject*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:7548:26: error: ‘class precice::SolverInterface’ has no member named ‘mapReadDataTo’
7548 | __pyx_v_self->thisptr->mapReadDataTo(__pyx_t_1);
| ^

/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_9Interface_68map_write_data_from(__pyx_obj_9cyprecice_Interface*, PyObject*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:7609:26: error: ‘class precice::SolverInterface’ has no member named ‘mapWriteDataFrom’
7609 | __pyx_v_self->thisptr->mapWriteDataFrom(__pyx_t_1);
| ^
~~~
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp: In function ‘PyObject* __pyx_pf_9cyprecice_2get_version_information(PyObject*)’:
/tmp/pip-install-hmoh00jl/pyprecice_48213de4461c476ca96d5f727ecab45c/cyprecice/cyprecice.cpp:11590:74: error: ‘getVersionInformation’ is not a member of ‘precice’
11590 | __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(precice::getVersionInformation()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1306, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~
error: command ‘/opt/gcc/11.3.0/bin/gcc’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyprecice
Failed to build pyprecice
ERROR: Could not build wheels for pyprecice, which is required to install pyproject.toml-based projects

I’ve noticed that there were commits to precice about 19 days ago that changed alot of the function names and it looks like py-precice wasn’t updated to accomadate that? Otherwise im not sure what my issue could be. I am also running this on a virtual environment.

How (exactly) are you installing the bindings? This part seems to be missing from the log.

This part seems relevant:

:11: UserWarning: It looks like you are not using pip for installation. Installing the package via ‘pip3 install --user .’ is recommended. You can still use ‘python3 setup.py install --user’, if you want and if the bindings work correctly, you do not have to worry. However, if you face problems during installation or running pyprecice, this means that you have to make sure that all dependencies are installed correctly and repeat the installation of pyprecice. Refer to pyproject.toml for a list of dependencies.

I’ve noticed that there were commits to precice about 19 days ago that changed alot of the function names and it looks like py-precice wasn’t updated to accomadate that?

There are currently many changes happening in preCICE, preparing for v3, but everything is currently on develop. If you are using preCICE v2.5.0, the latest bindings should work.

Maybe @IshaanDesai knows more here.

It sounds like you are installing the latest preCICE develop version from source and python bindings via pip. Due to the changes @Makis mentioned above, you should build/install with the tagged version ‘v2.5.0’ then you should not have any problem.

Could you give more information regarding how you installed preCICE (source/package/spack) and how you are installing bindings (pip/source)?

2 Likes