Skip to content

Unable to build Pydantic-Core 2.16.3 on Alpine 3.19 #1220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolargo opened this issue Mar 9, 2024 · 3 comments
Closed

Unable to build Pydantic-Core 2.16.3 on Alpine 3.19 #1220

nicolargo opened this issue Mar 9, 2024 · 3 comments
Assignees

Comments

@nicolargo
Copy link

Hi all,

fail to build on Alpine image (works fine on Ubuntu image):

#65 [linux/386 buildfull 1/1] RUN /venv-build/bin/python3.11 -m pip install --target="/venv/lib/python3.11/site-packages"     -r optional-requirements.txt
#65 343.8   Building wheel for pydantic-core (pyproject.toml): finished with status 'error'
#65 343.8   error: subprocess-exited-with-error
#65 343.8   
#65 343.8   × Building wheel for pydantic-core (pyproject.toml) did not run successfully.
#65 343.8   │ exit code: 1
#65 343.8   ╰─> [163 lines of output]
#65 343.8       Running `maturin pep517 build-wheel -i /venv-build/bin/python3.11 --compatibility off`
#65 343.8       📦 Including license file "/tmp/pip-install-4elwn96n/pydantic-core_49975d8d5dd44c68b82ec7cf35984c57/LICENSE"
#65 343.8       🍹 Building a mixed python/rust project
#65 343.8       🔗 Found pyo3 bindings
#65 343.8       🐍 Found CPython 3.11 at /venv-build/bin/python3.11
#65 343.8       📡 Using build options features, bindings from pyproject.toml
#65 343.8       warning: unused manifest key `lints` (may be supported in a future version)
#65 343.8       
#65 343.8       this Cargo does not support nightly features, but if you
#65 343.8       switch to nightly channel you can pass
#65 343.8       `-Zlints` to enable this feature.
#65 343.8          Compiling autocfg v1.1.0
#65 343.8          Compiling proc-macro2 v1.0.76
#65 343.8          Compiling unicode-ident v1.0.10
#65 343.8          Compiling target-lexicon v0.12.9
#65 343.8          Compiling libc v0.2.147
#65 343.8          Compiling python3-dll-a v0.2.9
#65 343.8          Compiling once_cell v1.18.0
#65 343.8          Compiling quote v1.0.35
#65 343.8          Compiling pyo3-build-config v0.20.2
#65 343.8          Compiling syn v2.0.48
#65 343.8          Compiling version_check v0.9.4
#65 343.8          Compiling cfg-if v1.0.0
#65 343.8          Compiling static_assertions v1.1.0
#65 343.8          Compiling heck v0.4.1
#65 343.8          Compiling lexical-util v0.8.5
#65 343.8          Compiling ahash v0.8.7
#65 343.8          Compiling num-traits v0.2.16
#65 343.8          Compiling getrandom v0.2.10
#65 343.8          Compiling num-integer v0.1.45
#65 343.8          Compiling lock_api v0.4.10
#65 343.8          Compiling parking_lot_core v0.9.8
#65 343.8          Compiling pyo3-ffi v0.20.2
#65 343.8          Compiling rustversion v1.0.13
#65 343.8          Compiling zerocopy v0.7.32
#65 343.8          Compiling memoffset v0.9.0
#65 343.8          Compiling num-bigint v0.4.4
#65 343.8          Compiling tinyvec_macros v0.1.1
#65 343.8          Compiling scopeguard v1.1.0
#65 343.8          Compiling smallvec v1.11.2
#65 343.8          Compiling allocator-api2 v0.2.16
#65 343.8          Compiling pyo3-macros-backend v0.20.2
#65 343.8          Compiling hashbrown v0.14.3
#65 343.8          Compiling tinyvec v1.6.0
#65 343.8          Compiling lexical-parse-integer v0.8.6
#65 343.8          Compiling lexical-write-integer v0.8.5
#65 343.8          Compiling pyo3 v0.20.2
#65 343.8          Compiling memchr v2.6.3
#65 343.8          Compiling serde v1.0.195
#65 343.8          Compiling lexical-write-float v0.8.5
#65 343.8          Compiling aho-corasick v1.0.2
#65 343.8          Compiling lexical-parse-float v0.8.5
#65 343.8          Compiling serde_derive v1.0.195
#65 343.8          Compiling strum_macros v0.25.3
#65 343.8          Compiling pyo3-macros v0.20.2
#65 343.8          Compiling unicode-normalization v0.1.22
#65 343.8          Compiling parking_lot v0.12.1
#65 343.8          Compiling indoc v2.0.4
#65 343.8          Compiling regex-syntax v0.8.2
#65 343.8          Compiling unicode-bidi v0.3.13
#65 343.8          Compiling equivalent v1.0.1
#65 343.8          Compiling serde_json v1.0.109
#65 343.8          Compiling percent-encoding v2.3.1
#65 343.8          Compiling unindent v0.2.3
#65 343.8          Compiling regex-automata v0.4.3
#65 343.8          Compiling form_urlencoded v1.2.1
#65 343.8          Compiling indexmap v2.0.0
#65 343.8          Compiling idna v0.5.0
#65 343.8          Compiling strum v0.25.0
#65 343.8          Compiling lexical-core v0.8.5
#65 343.8          Compiling pydantic-core v2.16.3 (/tmp/pip-install-4elwn96n/pydantic-core_49975d8d5dd44c68b82ec7cf35984c57)
#65 343.8          Compiling ryu v1.0.14
#65 343.8          Compiling itoa v1.0.8
#65 343.8          Compiling jiter v0.0.6
#65 343.8          Compiling url v2.5.0
#65 343.8          Compiling speedate v0.13.0
#65 343.8          Compiling regex v1.10.2
#65 343.8          Compiling enum_dispatch v0.3.12
#65 343.8          Compiling uuid v1.6.1
#65 343.8          Compiling base64 v0.21.7
#65 343.8       warning: unused import: `ffi`
#65 343.8        --> src/tools.rs:6:12
#65 343.8         |
#65 343.8       6 | use pyo3::{ffi, intern, FromPyObject};
#65 343.8         |            ^^^
#65 343.8         |
#65 343.8         = note: `#[warn(unused_imports)]` on by default
#65 343.8       
#65 343.8       error[E0446]: crate-private type `extra::Extra<'_>` in public interface
#65 343.8          --> src/serializers/fields.rs:149:5
#65 343.8           |
#65 343.8       149 | /     pub fn main_to_python<'py>(
#65 343.8       150 | |         &self,
#65 343.8       151 | |         py: Python<'py>,
#65 343.8       152 | |         main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
#65 343.8       ...   |
#65 343.8       155 | |         extra: Extra,
#65 343.8       156 | |     ) -> PyResult<&'py PyDict> {
#65 343.8           | |______________________________^ can't leak crate-private type
#65 343.8           |
#65 343.8          ::: src/serializers/extra.rs:73:1
#65 343.8           |
#65 343.8       73  |   pub(crate) struct Extra<'a> {
#65 343.8           |   --------------------------- `extra::Extra<'_>` declared as crate-private
#65 343.8       
#65 343.8       error[E0446]: crate-private type `extra::Extra<'_>` in public interface
#65 343.8          --> src/serializers/fields.rs:214:5
#65 343.8           |
#65 343.8       214 | /     pub fn main_serde_serialize<'py, S: serde::ser::Serializer>(
#65 343.8       215 | |         &self,
#65 343.8       216 | |         main_iter: impl Iterator<Item = PyResult<(&'py PyAny, &'py PyAny)>>,
#65 343.8       217 | |         expected_len: usize,
#65 343.8       ...   |
#65 343.8       221 | |         extra: Extra,
#65 343.8       222 | |     ) -> Result<S::SerializeMap, S::Error> {
#65 343.8           | |__________________________________________^ can't leak crate-private type
#65 343.8           |
#65 343.8          ::: src/serializers/extra.rs:73:1
#65 343.8           |
#65 343.8       73  |   pub(crate) struct Extra<'a> {
#65 343.8           |   --------------------------- `extra::Extra<'_>` declared as crate-private
#65 343.8       
#65 343.8       error[E0446]: crate-private type `extra::Extra<'_>` in public interface
#65 343.8          --> src/serializers/fields.rs:260:5
#65 343.8           |
#65 343.8       260 | /     pub fn add_computed_fields_python(
#65 343.8       261 | |         &self,
#65 343.8       262 | |         model: Option<&PyAny>,
#65 343.8       263 | |         output_dict: &PyDict,
#65 343.8       ...   |
#65 343.8       266 | |         extra: &Extra,
#65 343.8       267 | |     ) -> PyResult<()> {
#65 343.8           | |_____________________^ can't leak crate-private type
#65 343.8           |
#65 343.8          ::: src/serializers/extra.rs:73:1
#65 343.8           |
#65 343.8       73  |   pub(crate) struct Extra<'a> {
#65 343.8           |   --------------------------- `extra::Extra<'_>` declared as crate-private
#65 343.8       
#65 343.8       error[E0446]: crate-private type `extra::Extra<'_>` in public interface
#65 343.8          --> src/serializers/fields.rs:277:5
#65 343.8           |
#65 343.8       277 | /     pub fn add_computed_fields_json<S: serde::ser::Serializer>(
#65 343.8       278 | |         &self,
#65 343.8       279 | |         model: Option<&PyAny>,
#65 343.8       280 | |         map: &mut S::SerializeMap,
#65 343.8       ...   |
#65 343.8       283 | |         extra: &Extra,
#65 343.8       284 | |     ) -> Result<(), S::Error> {
#65 343.8           | |_____________________________^ can't leak crate-private type
#65 343.8           |
#65 343.8          ::: src/serializers/extra.rs:73:1
#65 343.8           |
#65 343.8       73  |   pub(crate) struct Extra<'a> {
#65 343.8           |   --------------------------- `extra::Extra<'_>` declared as crate-private
#65 343.8       
#65 343.8       For more information about this error, try `rustc --explain E0446`.
#65 343.8       warning: `pydantic-core` (lib) generated 1 warning
#65 343.8       error: could not compile `pydantic-core` (lib) due to 4 previous errors; 1 warning emitted
#65 343.8       💥 maturin failed
#65 343.8         Caused by: Failed to build a native library through cargo
#65 343.8         Caused by: Cargo build finished with "exit status: 101": `CARGO_ENCODED_RUSTFLAGS="-C\u{1f}target-feature=-crt-static" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/venv-build/bin/python3.11" PYTHON_SYS_EXECUTABLE="/venv-build/bin/python3.11" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-4elwn96n/pydantic-core_49975d8d5dd44c68b82ec7cf35984c57/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib"`
#65 343.8       Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/venv-build/bin/python3.11', '--compatibility', 'off'] returned non-zero exit status 1
#65 343.8       [end of output]
#65 343.8   
#65 343.8   note: This error originates from a subprocess, and is likely not a problem with pip.
#65 343.8   ERROR: Failed building wheel for pydantic-core

Any idea ?

@nicolargo
Copy link
Author

Additional question: why does requirements.txt include requirements-tests.txt (where Pydantic is used) ? Are the dependencies of requirements-tests.txt used during the run time ?

@davidhewitt
Copy link
Contributor

Duplicate of #1176

I think the next pydantic-core release should resolve the problem. In the meanwhile you can update to a newer Rust compiler before building.

@davidhewitt davidhewitt closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@davidhewitt
Copy link
Contributor

Additional question: why does requirements.txt include requirements-tests.txt (where Pydantic is used) ? Are the dependencies of requirements-tests.txt used during the run time ?

I'm not sure what you're asking here, I don't think we have a requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants