Ioakim Ioakim
Ioakim Ioakim

Reputation: 1

Installing pydantic-core (2.16.3): Failed while executing "poetry install -E sam"

So I am trying to setup a project and I am following the readme instructions. I am stuck on this command "poetry install -E sam". It outputs the following message:

Installing dependencies from lock file

Package operations: 91 installs, 0 updates, 0 removals

  • Installing pydantic-core (2.16.3): Failed

ChefBuildError

Backend subprocess exited when trying to invoke build_wheel Running maturin pep517 build-wheel -i /private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpxt4446qb/.venv/bin/python --compatibility off šŸ“¦ Including license file "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/LICENSE" šŸ¹ Building a mixed python/rust project šŸ”— Found pyo3 bindings šŸ Found CPython 3.13 at /private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpxt4446qb/.venv/bin/python šŸ“” Using build options features, bindings from pyproject.toml šŸ’» Using MACOSX_DEPLOYMENT_TARGET=11.0 for aarch64-apple-darwin by default Compiling ... error: failed to run custom build command for pydantic-core v2.16.3 (/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3) Caused by: process didn't exit successfully: /private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/target/release/build/pydantic-core-39a2e9245b501e5a/build-script-build (exit status: 101) --- stdout cargo:rustc-cfg=Py_3_6 cargo:rustc-cfg=Py_3_7 cargo:rustc-cfg=Py_3_8 cargo:rustc-cfg=Py_3_9 cargo:rustc-cfg=Py_3_10 cargo:rustc-cfg=Py_3_11 cargo:rustc-cfg=Py_3_12 cargo:rustc-cfg=Py_3_13 cargo:rerun-if-changed=python/pydantic_core/core_schema.py cargo:rerun-if-changed=generate_self_schema.py

--- stderr
Traceback (most recent call last):
  File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py",

line 192, in eval_forward_ref return type_._evaluate(core_schema.dict, None, set()) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py",

line 240, in main() ~~~~^^ File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py", line 210, in main value = get_schema(s, definitions) File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py", line 54, in get_schema return type_dict_schema(obj, definitions) File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py", line 152, in type_dict_schema field_type = eval_forward_ref(field_type) File "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/generate_self_schema.py", line 195, in eval_forward_ref return type_._evaluate(core_schema.dict, None) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' thread 'main' panicked at build.rs:29:9: generate_self_schema.py failed with exit status: 1 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace 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 MACOSX_DEPLOYMENT_TARGET="11.0" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.13-64bit" PYO3_PYTHON="/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpxt4446qb/.venv/bin/python" PYTHON_SYS_EXECUTABLE="/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpxt4446qb/.venv/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpz728d29q/pydantic_core-2.16.3/Cargo.toml" "--release" "--lib" "--crate-type" "cdylib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/pydantic_core._pydantic_core.cpython-313-darwin.so" Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/private/var/folders/wc/58gd_dz17b54xr8094v5ss100000gq/T/tmpxt4446qb/.venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1

at ~/.local/pipx/venvs/poetry/lib/python3.13/site-packages/poetry/installation/chef.py:164 in _prepare 160ā”‚ 161ā”‚ error = ChefBuildError("\n\n".join(message_parts)) 162ā”‚ 163ā”‚ if error is not None: ā†’ 164ā”‚ raise error from None 165ā”‚ 166ā”‚ return path 167ā”‚ 168ā”‚ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pydantic-core (2.16.3) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pydantic-core (==2.16.3)"'.

I tried using ChatGPT to debug it. He suggested I change the python version. I changed the project setting and used python version 3.12. But apparently I need to change is somewhere else because it still says "Found CPython 3.13"

Extra info: I do not know if this helps but before I got this message it would fail to install another package when running the same command. It said "Installing rpds-py (0.18.0): Failed".

ChatGPT suggested I install rust which successfully solved it and the command moved on to install further package and now its stuck at this one.

Upvotes: 0

Views: 321

Answers (1)

Emeka Okafor
Emeka Okafor

Reputation: 1

Hi i encountered the same issue, all i did was to delete the poetry.lock file and ran peotry install

Upvotes: 0

Related Questions