cibuildwheel icon indicating copy to clipboard operation
cibuildwheel copied to clipboard

pyodide build failure

Open LecrisUT opened this issue 1 year ago • 3 comments
trafficstars

Description

Sharing my experience enabling pyodide build for spglib. Not sure how to debug it though.

  + pytest /home/runner/work/spglib/spglib/test/functional/python
  Failed to load lib  /tmp/cibw-run-2g4v63rz/cp312-pyodide_wasm32/venv-test/lib/python3.12/site-packages/spglib/_spglib.so
  Error: Didn't expect to load any more file_packager files!
      at D.u.locateFile (/home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.js:9:10008)
      at locateFile (/home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.asm.js:10:774)
      at loadLibData (/home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.asm.js:10:153821)
      at getExports (/home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.asm.js:10:154250)
      at loadDynamicLibrary (/home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.asm.js:10:154598)
      at /home/runner/.cache/cibuildwheel/.pyodide-xbuildenv-0.26.1/0.26.1/xbuildenv/pyodide-root/dist/pyodide.asm.js:10:151157

Build log

https://github.com/spglib/spglib/actions/runs/10356874250/job/28667846634

CI config

No response

LecrisUT avatar Aug 12 '24 18:08 LecrisUT

PermissionError: [Errno 2] Permission denied: '/home/runner/work/spglib/spglib/pytest-cache-files-sodvmnvb/README.md'

You need to turn off the pytest cache for Pyodide or just ignore the warning if you have warnings as errors.

I often have this, too:

[tool.pytest.ini_options]
filterwarnings = [
  "error",
  "default:could not create cache path:pytest.PytestCacheWarning",
]

[[tool.cibuildwheel.overrides]]
select = "*pyodide*"
inherit.environment = "append"
environment.CFLAGS = "-fexceptions"
environment.LDFLAGS = "-fexceptions"
build-frontend = {name = "build", args = ["--exports", "whole_archive"]}

(Next release of pybind11 might stop requiring the -fexceptions to be added. Other frameworks may or may not need it.)

henryiii avatar Aug 12 '24 18:08 henryiii

Weird it did not get picked up :/. I guess otherwise Failed to load lib is a red-herring?

LecrisUT avatar Aug 12 '24 19:08 LecrisUT

If you don't want to filter the warnings and to turn off the pytest cache during the testing step, you can do pytest -p no:cacheprovider <...>

agriyakhetarpal avatar Aug 14 '24 16:08 agriyakhetarpal

I think this was fixed upstream at some point between the 0.27 and 0.28 release cycles, and disabling the cacheprovider plugin is no longer required – I haven't used it for quite a while now.

agriyakhetarpal avatar Aug 18 '25 02:08 agriyakhetarpal

FWIW, JupyterLab doesn't support 0.28 yet, so I still have to support 0.27 everywhere. Most of my compiled code is scientific which is used in JupyterLab.

henryiii avatar Sep 10 '25 03:09 henryiii

Oh, it's available on the pre-releases: https://github.com/jupyterlite/pyodide-kernel/releases/tag/v0.7.0a0 and later. But indeed, there is some time until we have a stable JupyterLite (and a further Pyodide kernel) release. I also have to work on https://github.com/jupyterlite/pyodide-kernel/pull/208.

agriyakhetarpal avatar Sep 10 '25 07:09 agriyakhetarpal