Skip to content

Conversation

@fsimonis
Copy link
Member

This PR adds a fallback to the setup.py in case preCICE is not found via pkg-config.

The fallback uses no cflags (aka. expect system install) and the -lprecice ldflag.

This allows to always build a source distribution of the bindings, which is important for a smooth release process.

A missing preCICE installation will result in a failed wheel build with:

$ pyprecice-build -w
...
* Building wheel...
pkg-config was unable to find libprecice.
Please make sure that preCICE was installed correctly and pkg-config is able to find it.
You may need to set PKG_CONFIG_PATH to include the location of the libprecice.pc file.
Use "pkg-config --modversion libprecice" for debugging.
running bdist_wheel
running build
running build_py
copying precice/__init__.py -> build/lib.linux-x86_64-cpython-313/precice
running egg_info
writing pyprecice.egg-info/PKG-INFO
writing dependency_links to pyprecice.egg-info/dependency_links.txt
writing requirements to pyprecice.egg-info/requires.txt
writing top-level names to pyprecice.egg-info/top_level.txt
dependency /tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative
dependency /tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative
dependency /tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative
dependency /tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative
reading manifest file 'pyprecice.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.txt'
writing manifest file 'pyprecice.egg-info/SOURCES.txt'
running build_ext
building 'cyprecice' extension
x86_64-linux-gnu-g++ -Wall -Wextra -Wno-unused-parameter -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/tmp/build-env-zypkvg05/lib/python3.13/site-packages/numpy/_core/include -I/tmp/build-env-zypkvg05/include -I/usr/include/python3.13 -c cyprecice/cyprecice.cpp -o build/temp.linux-x86_64-cpython-313/cyprecice/cyprecice.o -std=c++17
cyprecice/cyprecice.cpp:1199:10: fatal error: precice/precice.hpp: No such file or directory
 1199 | #include "precice/precice.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel

@fsimonis fsimonis requested a review from IshaanDesai October 14, 2025 11:26
@fsimonis fsimonis self-assigned this Oct 14, 2025
@fsimonis fsimonis force-pushed the fallback-in-setuppy branch from 1f1ce08 to 0d77833 Compare October 14, 2025 11:28
Copy link
Member

@IshaanDesai IshaanDesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows to always build a source distribution of the bindings, which is important for a smooth release process.

Does this essentially mean that now we allow pyprecice to be built on a system where preCICE is potentially not installed or not findable?

@fsimonis
Copy link
Member Author

fsimonis commented Oct 15, 2025

Installing pyprecice without preCICE installed will always fail when building the wheel.

The only thing that now works on a system without preCICE is to "build" or assemble the source distribution.

So the error is now triggered one step further down the line, when compiling instead of the configuration stage of the extensions.

@IshaanDesai IshaanDesai merged commit 822e810 into develop Oct 15, 2025
10 checks passed
@IshaanDesai IshaanDesai deleted the fallback-in-setuppy branch October 15, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants