pydantic / pydantic-core

Core validation logic for pydantic written in rust
MIT License
1.45k stars 247 forks source link

Error installing from source : error: failed to select a version for the requirement `ahash = "^0.8.0"` #923

Closed tonybaloney closed 1 year ago

tonybaloney commented 1 year ago

I followed the steps for compiling from source (git clone, venv and make install) but got the following error in the installation

....
Successfully installed colorama-0.4.6 griffe-0.34.0 mypy-1.5.1 pyright-1.1.323 typing-extensions-4.7.1
pip install -e .
Obtaining file:///Users/anthonyshaw/projects/pydantic-core
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
          Updating crates.io index
      error: failed to select a version for the requirement `ahash = "^0.8.0"`
      candidate versions found which didn't match: 0.8.0, 0.7.6, 0.7.5, ...
      location searched: crates.io index
      required by package `pydantic-core v2.6.3 (/Users/anthonyshaw/projects/pydantic-core)`
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/j4/zngd8xzn5bj14jfr2vyygwj40000gn/T/pip-modern-metadata-vwp5w97w', '--interpreter', '/Users/anthonyshaw/projects/pydantic-core/.venv/bin/python3.11']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/j4/zngd8xzn5bj14jfr2vyygwj40000gn/T/pip-modern-metadata-vwp5w97w --interpreter /Users/anthonyshaw/projects/pydantic-core/.venv/bin/python3.11`
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
make: *** [install] Error 1
> cargo --version
cargo 1.59.0
> python  -V
Python 3.11.1

Selected Assignee: @dmontagu

tonybaloney commented 1 year ago

Updating rust (brew upgrade rust) to the latest version fixed it 👍🏻