You are not logged in.
Hello.
I faced a strange error while packaging a python package using the recommended way for that.
The python package in question has both `pyproject.toml` and `setup.py` files. The preferred way is to use `pyproject.toml` and run the command
python -m build --wheel --no-isolation
in `build`. But if I do that, I get an error:
ERROR Missing dependencies:
ninja
cmake>=3.18
I don't get why I see this error even though I have both `ninja` and `cmake` installed. Searching the Web, I didn't find anything suspicious with `pyproject.toml` of the package, nor any special requirements for using `cmake` and `ninja` in `pyproject.toml`. I suspect that this particular package can't be build using `pyproject.toml` and I have to use `setup.py`. Of course, the traditional way
python setup.py build
works fine.
This is `pyproject.toml` of the package:
[build-system]
requires = ["setuptools>=42", "wheel", "scikit-build", "cmake>=3.18", "ninja", "numpy>=1.21"]
And this is `setup.py`:
from skbuild import setup
# read the contents of your README file
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name="mumpropagator",
version="1.0.3",
description="A python interface to Muon Propagator package MUM, developed by Igor Sokalski",
license="MIT",
packages=['mumpropagator'],
cmake_args=['-DSKBUILD=ON'],
long_description=long_description,
long_description_content_type='text/markdown'
)
The package name is `mumpropagator` (https://pypi.org/project/mumpropagator/).
Would someone comment on that particular error, or am I right and I can't use the “recommended” way to package this particular python module?
Offline
Not an expert on this, but I thought skbuild wraps CMake, Is there a Makefile as well in the project? I *think* that setup.py invokes CMake, and its Makefile perhaps in turn invokes something that uses the pyproject.toml?
Offline
is the requires = [...] are python modules (from pypi), not system packages?
Offline
Post the PKGBUILD
Offline
@twelveeighty
skbuild wraps CMake... setup.py invokes CMake, and its Makefile perhaps in turn invokes something that uses the pyproject.toml
If I understand correctly, `setup.py` invokes `cmake` for configuration, which in turn invokes `ninja` (or they are invoked in sequence) that why I see `cmake` and `ninja` in `requires`. But I got the impression that if a python module has `pyproject.toml` I should run the command
python -m build --wheel --no-isolation
to package it as an Archlinux (python) package.
@astralc
is the requires = [...] are python modules (from pypi), not system packages?
I don't know. I tried to search for `cmake` and `ninja` python modules but found nothing, so I assumed that these are “required” programs.
But now, on the second thought, I think that I get the instructions wrong, since almost all examples for scikit-build system have both `pyproject.toml` and `setup.py`, so it seems to be a feature of the skbuild build system.
@a821, sure:
# Maintainer: Vladimir Lomov < lomov.vl at bkoty.ru >
pkgname=python-mumpropagator
_name=${pkgname#python-}
pkgver=1.0.3
pkgrel=3
pkgdesc="A python interface to Muon Propagator package MUM, developed by Igor Sokalski"
url="https://git.jinr.ru/lomov/mumpropagator/"
depends=(python)
makedepends=(
python-build python-installer python-wheel python-numpy python-scikit-build
cmake ninja
)
license=(MIT)
arch=(x86_64)
source=(
"${pkgname}::git+${url}#tag=v${pkgver}"
)
sha256sums=(
SKIP
)
build()
{
cd "${pkgname}"
python setup.py build
}
package()
{
cd "${pkgname}"
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
python setup.py install --root="$pkgdir" --skip-build --optimize='1'
install -m755 -d "${pkgdir}/usr/share/doc/${pkgname}/"
install -m644 -D \
${pkgdir}${site_packages}/mumpropagator/pymum_example.py \
"${pkgdir}/usr/share/doc/${pkgname}/"
find ${pkgdir}${site_packages} -name "*_example*" -exec rm '{}' \;
}
(Please, ignore url and license for a moment, and note that currently maintainer/contributor's e-mail is incorrect.)
Offline
there are some packaged versions in pypi for them, maybe the build file assume you use it:
https://pypi.org/project/cmake/
https://pypi.org/project/ninja/
it mention scikit-build there
what happen if you remove them from the requires list and build?
I think --no-isolation don't download the build dependencies in python.
Offline
@astralc
there are some packaged versions in pypi for them, maybe the build file assume you use it:
https://pypi.org/project/cmake/
https://pypi.org/project/ninja/
it mention scikit-build there
Yes, I found them earlier, but I thought that it was a way to install `cmake` and `ninja` on a system that doesn't have them (when one uses `pip`). To quote the pages:
The CMake python wheels provide CMake 3.24.1.
and
The latest Ninja python wheels provide ninja 1.10.2.g51db2.kitware.jobserver-1 executable and ninja_syntax.py for generating .ninja files.
So I thought if I already have cmake and ninja packages, then the requirements are met.
what happen if you remove them from the requires list and build?
Hmmm... actually I tried that, please see https://git.sr.ht/~vp1981/pkgbuild/tree … propagator. So basically, if I remove those two entries from `requires` I can use the recommended way to make the Archlinux python package, but this is rude. Now I'm wondering why skbuild build system recommends having `cmake` and `ninja` to `requires` and how that supposes to work?
After all, that's why I asked this question here, because I have no idea what's wrong and what to do.
Offline