messense / nh3

Python binding to Ammonia HTML sanitizer Rust crate
https://nh3.readthedocs.io
MIT License
260 stars 8 forks source link

Failed building wheel on linux #48

Closed kevinbdsouza closed 4 months ago

kevinbdsouza commented 4 months ago

I'm on linux x86_64, with python 3.11. pip install nh3 gives maturin failed error, see error log below. I tried with different nh3 versions (0.2.14-0.2.18) and different rust versions (1.77 and 1.79), but get the same maturin failed error. Not sure what's causing this, and any help is appreciated.

Error log Looking in links: /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/gentoo2023/x86-64-v3, /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/gentoo2023/generic, /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic Collecting nh3==0.2.15 Downloading nh3-0.2.15.tar.gz (14 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: nh3 Building wheel for nh3 (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for nh3 (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [177 lines of output] Running `maturin pep517 build-wheel -i concordia/bin/python3.11 --compatibility off` 🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.7 🐍 Not using a specific python interpreter Compiling libc v0.2.150 Compiling proc-macro2 v1.0.70 Compiling unicode-ident v1.0.12 Compiling cfg-if v1.0.0 Compiling autocfg v1.1.0 Compiling target-lexicon v0.12.12 Compiling ppv-lite86 v0.2.17 Compiling siphasher v0.3.11 Compiling parking_lot_core v0.9.9 Compiling scopeguard v1.2.0 Compiling smallvec v1.11.2 Compiling once_cell v1.19.0 Compiling syn v1.0.109 Compiling new_debug_unreachable v1.0.4 Compiling serde v1.0.193 Compiling tinyvec_macros v0.1.1 Compiling mac v0.1.1 Compiling utf-8 v0.7.6 Compiling precomputed-hash v0.1.1 Compiling percent-encoding v2.3.1 Compiling log v0.4.20 Compiling heck v0.4.1 Compiling unicode-bidi v0.3.14 Compiling indoc v2.0.4 Compiling maplit v1.0.2 Compiling unindent v0.2.3 Compiling tinyvec v1.6.0 Compiling futf v0.1.5 Compiling form_urlencoded v1.2.1 Compiling phf_shared v0.10.0 Compiling tendril v0.4.3 Compiling lock_api v0.4.11 Compiling memoffset v0.9.0 Compiling phf v0.10.1 Compiling quote v1.0.33 Compiling pyo3-build-config v0.20.0 Compiling unicode-normalization v0.1.22 Compiling syn v2.0.39 Compiling getrandom v0.2.11 Compiling rand_core v0.6.4 Compiling parking_lot v0.12.1 Compiling rand_chacha v0.3.1 Compiling idna v0.5.0 Compiling rand v0.8.5 Compiling url v2.5.0 Compiling pyo3-ffi v0.20.0 Compiling pyo3 v0.20.0 Compiling phf_generator v0.10.0 Compiling string_cache_codegen v0.5.2 Compiling phf_codegen v0.10.0 Compiling markup5ever v0.11.0 Compiling string_cache v0.8.7 Compiling pyo3-macros-backend v0.20.0 Compiling html5ever v0.26.0 Compiling pyo3-macros v0.20.0 error[E0463]: can't find crate for `pyo3_macros` --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/prelude.rs:20:9 | 20 | pub use pyo3_macros::{pyclass, pyfunction, pymethods, pymodule, FromPyObject}; | ^^^^^^^^^^^ can't find crate error[E0463]: can't find crate for `pyo3_macros` --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/lib.rs:439:9 | 439 | pub use pyo3_macros::{pyfunction, pymethods, pymodule, FromPyObject}; | ^^^^^^^^^^^ can't find crate error[E0463]: can't find crate for `pyo3_macros` --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/lib.rs:450:9 | 450 | pub use pyo3_macros::pyclass; | ^^^^^^^^^^^ can't find crate error[E0463]: can't find crate for `indoc` --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/lib.rs:381:5 | 381 | indoc, // Re-exported for py_run | ^^^^^ can't find crate error[E0432]: unresolved imports `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject`, `crate::FromPyObject` --> /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/array.rs:4:10 | 4 | ffi, FromPyObject, IntoPy, Py, PyAny, PyDowncastError, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/ipaddr.rs:6:21 | 6 | use crate::{intern, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, Python, ToPyObject}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/map.rs:7:5 | 7 | FromPyObject, IntoPy, PyAny, PyErr, PyObject, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/num.rs:4:22 | 4 | exceptions, ffi, FromPyObject, IntoPy, PyAny, PyErr, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/osstr.rs:2:18 | 2 | use crate::{ffi, FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/path.rs:2:10 | 2 | ffi, FromPyObject, FromPyPointer, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/set.rs:6:46 | 6 | types::set::new_from_iter, types::PySet, FromPyObject, IntoPy, PyAny, PyObject, PyResult, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/slice.rs:3:29 | 3 | use crate::{types::PyBytes, FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/conversions/std/string.rs:6:22 | 6 | types::PyString, FromPyObject, IntoPy, Py, PyAny, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/impl_/extract_argument.rs:6:5 | 6 | FromPyObject, PyAny, PyClass, PyErr, PyRef, PyRefMut, PyResult, Python, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/impl_/frompyobject.rs:1:38 | 1 | use crate::{exceptions::PyTypeError, FromPyObject, PyAny, PyErr, PyResult, Python}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/instance.rs:8:23 | 8 | ffi, AsPyPointer, FromPyObject, IntoPy, PyAny, PyClass, PyClassInitializer, PyRef, PyRefMut, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/types/boolobject.rs:3:18 | 3 | use crate::{ffi, FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python, ToPyObject}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/types/bytes.rs:1:18 | 1 | use crate::{ffi, FromPyObject, IntoPy, Py, PyAny, PyResult, Python, ToPyObject}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/types/floatob.rs:4:10 | 4 | ffi, FromPyObject, IntoPy, PyAny, PyErr, PyNativeType, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/types/sequence.rs:10:13 | 10 | use crate::{FromPyObject, PyTryFrom}; | ^^^^^^^^^^^^ | ::: /home/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.0/src/types/tuple.rs:11:17 | 11 | exceptions, FromPyObject, IntoPy, Py, PyAny, PyErr, PyObject, PyResult, Python, ToPyObject, | ^^^^^^^^^^^^ Compiling ammonia v3.3.0 Some errors have detailed explanations: E0432, E0463. For more information about an error, try `rustc --explain E0432`. error: could not compile `pyo3` (lib) due to 5 previous errors warning: build failed, waiting for other jobs to finish... 💥 maturin failed Caused by: Failed to build a native library through cargo Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="concordia/bin/python3.11" PYTHON_SYS_EXECUTABLE="concordia/bin/python3.11" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-j86bsuzt/nh3_0a79c23311074ad0be8321120052238b/Cargo.toml" "--release" "--lib"` Error: command ['maturin', 'pep517', 'build-wheel', '-i', 'concordia/bin/python3.11', '--compatibility', 'off'] returned non-zero exit status 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for nh3 Failed to build nh3 ERROR: Could not build wheels for nh3, which is required to install pyproject.toml-based projects
kevinbdsouza commented 4 months ago

Fixed by running module load rust on compute canada and pip install nh3.