Error when installing Python bindings

Hello, I am trying to build pyprecice, but I get an error that I cannot solve. During a build process that uses CMake, a shell script that uses pip to install pyprecice is executed. The installation with pip gives the following error:

  Building wheel for pyprecice (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python /usr/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpfvrjunxx
       cwd: /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd
  Complete output (55 lines):
  Failed to load config from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/pyproject.toml: 'tool'
  Try to load it from setup.cfg
  running bdist_wheel
  running build
  running build_py
  Failed to load config from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/pyproject.toml: 'tool'
  Try to load it from setup.cfg
  Failed to load config from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/pyproject.toml: 'tool'
  Try to load it from setup.cfg
  creating build
  creating build/lib
  creating build/lib/precice
  copying precice/__init__.py -> build/lib/precice
  copying precice/_version.py -> build/lib/precice
  UPDATING build/lib/precice/_version.py
  set build/lib/precice/_version.py to '3.1.2'
  installing to build/bdist.linux-x86_64/wheel
  running install
  Compiling /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.pyx because it changed.
  [1/1] Cythonizing /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.pyx
  running install_lib
  running build_ext
  Failed to load config from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/pyproject.toml: 'tool'
  Try to load it from setup.cfg
  Failed to load config from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/pyproject.toml: 'tool'
  Try to load it from setup.cfg
  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-bonrvym1
  creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd
  creating build/temp.linux-x86_64-cpython-39/tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice
  /cm/shared/apps/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/icc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Wall -O3 -DNDEBUG -fPIC -I/tmp/pip-build-env-q54_23ph/overlay/lib64/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp -o build/temp.linux-x86_64-cpython-39/tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.o -std=c++17 -I/home/mdruyterdwildt/src/ReFRESCO_branch_rocky9/extLibs/include
  icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is deprecated and will be removed from product release in the second half of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended compiler moving forward. Please transition to use this compiler. Use '-diag-disable=10441' to disable this message.
  icc: command line warning #10148: option '-Wno-unused-result' not supported
  icc: command line warning #10148: option '-march=x86-64-v2' not supported
  icc: command line warning #10006: ignoring unknown option '-fstack-clash-protection'
  icc: command line warning #10148: option '-march=x86-64-v2' not supported
  icc: command line warning #10006: ignoring unknown option '-fstack-clash-protection'
  icc: command line warning #10148: option '-march=x86-64-v2' not supported
  icc: command line warning #10006: ignoring unknown option '-fstack-clash-protection'
  In file included from /tmp/pip-build-env-q54_23ph/overlay/lib64/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h(1929),
                   from /tmp/pip-build-env-q54_23ph/overlay/lib64/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h(12),
                   from /tmp/pip-build-env-q54_23ph/overlay/lib64/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h(5),
                   from /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp(1270):
  /tmp/pip-build-env-q54_23ph/overlay/lib64/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h(17): warning #1224: #warning directive: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
    #warning "Using deprecated NumPy API, disable it with " \
     ^

  /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp(1295): catastrophic error: cannot open source file "/tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp"
    #include "precice/Participant.hpp"
                                      ^

  compilation aborted for /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp (code 4)
  error: command '/cm/shared/apps/intel/oneapi/compiler/2023.1.0/linux/bin/intel64/icc' failed with exit code 4
  ----------------------------------------
  ERROR: Failed building wheel for pyprecice
Failed to build pyprecice
ERROR: Could not build wheels for pyprecice which use PEP 517 and cannot be installed directly

System specifications: Rocky Linux 9.4 (Blue Onyx), preCICE 3.1.2, CMake 3.26.5, oneapi/compiler/2023.1.0, oneapi/mkl/2023.1.0, oneapi/mpi/2021.9.0, Boost 1.73.0, PETSc 3.19.4.

I read here that the cause probably is that precice is not present or cannot be found. During my build process, precice is built just before pyprecice, so it is present. I tried the solution that is suggested on that page, but that does not solve my problem.

The build system that I use works well on our older system, with Rocky Linux 8 in stead of 9 and Intel oneapi 2023 in stead of 2021.

Hi,

This looks like icc cannot open the cpp file generated by cython. Maybe this is an issue with read/write permissions?

  /tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp(1295): catastrophic error: cannot open source file "/tmp/pip-install-bonrvym1/pyprecice_582a3590ac7242788108c0f472c81dbd/cyprecice/cyprecice.cpp"

It can be useful to put the following above the pip install in your script to see which version of preCICE can be found by the pkg-config:

pkg-config --modversion libprecice

Best
Frédéric

Hi Frédéric,

Your suggestion to add ‘pkg-config --modversion libprecice’ to the script helped a lot. It appeared that the build was still using our previous version of precice, 2.5.0. I have now made sure that it uses 3.1.2 and that solved the problem. Thanks a lot for your suggestion!

Kind regards,

Martijn

1 Like

Hi,

Thanks for the feedback!

I integrated this tip directly into the python-bindings to make some installation problems easier to understand.

Best
Frédéric

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.