-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Request
To build the package, python3-dev is required, otherwise installation of certain Python dependencies would fail. e.g.,
Building wheels for collected packages: mariadb
Building wheel for mariadb (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for mariadb (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
/tmp/pip-build-env-o0bv606x/overlay/lib/python3.10/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running bdist_wheel
running build
running build_py
creating build/lib.linux-x86_64-cpython-310/mariadb
copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-310/mariadb
copying mariadb/__init__.py -> build/lib.linux-x86_64-cpython-310/mariadb
creating build/lib.linux-x86_64-cpython-310/mariadb/constants
copying mariadb/constants/__init__.py -> build/lib.linux-x86_64-cpython-310/mariadb/constants
copying mariadb/constants/CLIENT.py -> build/lib.linux-x86_64-cpython-310/mariadb/constants
copying mariadb/constants/INDICATOR.py -> build/lib.linux-x86_64-cpython-310/mariadb/constants
copying mariadb/constants/CURSOR.py -> build/lib.linux-x86_64-cpython-310/mariadb/constants
copying mariadb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-cpython-310/mariadb/constants
running build_ext
building 'mariadb._mariadb' extension
creating build/temp.linux-x86_64-cpython-310/mariadb
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DPY_MARIADB_MAJOR_VERSION=1 -DPY_MARIADB_MINOR_VERSION=0 -DPY_MARIADB_PATCH_VERSION=11 -I/usr/include/mariadb -I/usr/include/mariadb/mysql -I./include -I/home/yscope/workspace/clp/build/package-venv/include -I/usr/include/python3.10 -c mariadb/mariadb.c -o build/temp.linux-x86_64-cpython-310/mariadb/mariadb.o -DDEFAULT_PLUGINS_SUBDIR=\"/usr/lib/x86_64-linux-gnu/libmariadb3/plugin\"
In file included from mariadb/mariadb.c:21:
./include/mariadb_python.h:21:10: fatal error: Python.h: No such file or directory
21 | #include "Python.h"
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-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 mariadb
Failed to build mariadb
ERROR: Could not build wheels for mariadb, which is required to install pyproject.toml-based projects
[notice] A new release of pip is available: 23.3.2 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
exit status 1
The error message suggest a Python C / C++ header is missing but does not hint what dependency package to install.
On the other hand, the dependency has already been documented at
| * python3-dev |
However,
python3-dev is not included in any dependency installation scripts, which might cause confusions to any new developers.
Possible implementation
Approach 1
Include python3-dev in
clp/components/core/tools/scripts/lib_install/ubuntu-jammy/install-prebuilt-packages.sh
Lines 10 to 29 in 2a92184
| DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | |
| ca-certificates \ | |
| checkinstall \ | |
| cmake \ | |
| curl \ | |
| build-essential \ | |
| git \ | |
| jq \ | |
| libcurl4 \ | |
| libcurl4-openssl-dev \ | |
| liblzma-dev \ | |
| libmariadb-dev \ | |
| libssl-dev \ | |
| openjdk-11-jdk \ | |
| pkg-config \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| software-properties-common \ | |
| unzip |
However, strictly speaking, python3-dev (and many other dependencies in that script) is not a dependency of CLP core.
Approach 2
Split the package building dependencies into a separate script. Then include python3-dev and other package-specific (non-CLP-core) dependencies inside.
Approach 3
Provide an error message whenever task package exits with non-zero. e.g.,
Failed to build package. Please check if `python3-dev` has been installed.