rules_pycross icon indicating copy to clipboard operation
rules_pycross copied to clipboard

Error trying to use pyspark

Open njlr opened this issue 1 year ago • 4 comments

When I try to use the pyspark package, I get this error:

Backend 'setuptools.build_meta:legacy' is not available.

Here is the pyproject.toml:

[tool.poetry]
name = "cowapp"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "3.10.11"
cowsay = "^6.1"
numpy = "^2.0.1"
pyspark = "^3.5.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Full repro code is here: https://github.com/njlr/rules_pycross_oci/tree/issue-pyspark

Trigger the error with:

bazel build //...

njlr avatar Sep 20 '24 10:09 njlr

Unfortunately build dependencies are not included in the poetry lock file, so you'll need to include them yourself like here. You'll also need to add dependencies on setuptools and wheel to pyproject.toml and re-lock.

jvolkman avatar Sep 20 '24 21:09 jvolkman

Unfortunately build dependencies are not included in the poetry lock file, so you'll need to include them yourself like here. You'll also need to add dependencies on setuptools and wheel to pyproject.toml and re-lock.

Thanks for the pointers.

I made some progress but hit a new error:

ERROR Backend 'mesonpy' is not available.

Repro is in https://github.com/njlr/rules_pycross_oci/tree/issue-pyspark

njlr avatar Sep 21 '24 08:09 njlr

It's the same issue: you'd need to add an explicit dependency on mesonpy.

But meson is a full-fledged build system, so I'm not sure that attempting to build a wheel with it will be very successful nested within a Bazel invocation. It's been on my TODO list for a while to add support for other build systems like meson, maturin (for rust-based wheels), etc. Currently the wheel builder in this rule set assumes setuptools and distutils. These are by and large still the standard, though, so maybe mesonpy will also work with the same assumptions. But I've never tried.

jvolkman avatar Sep 22 '24 00:09 jvolkman

I attempted to add this, but I still get the same error:

ERROR Backend 'mesonpy' is not available.

Added here: https://github.com/njlr/rules_pycross_oci/blob/0df866815655f837603a05db81e7cc00eb05b759/cowapp/BUILD.bazel#L40-L45

Any ideas?

njlr avatar Dec 04 '24 21:12 njlr