Skip to content
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

Problem with Cargo while installing pydantic-core #2450

Open
socloseeee opened this issue Sep 1, 2024 · 3 comments
Open

Problem with Cargo while installing pydantic-core #2450

socloseeee opened this issue Sep 1, 2024 · 3 comments

Comments

@socloseeee
Copy link

I've installed cargo and rust:

apk add rustc
apk add cargo

But every time I encounter the same problem when installing the pip package pydantic:

(venv) localhost:~/HamsterValor# pip install pydantic
Collecting pydantic
  Using cached pydantic-2.8.2-py3-none-any.whl (423 kB)
Requirement already satisfied: typing-extensions>=4.6.1 in /usr/lib/python3.10/site-packages (from pydantic) (4.12.2)
Collecting pydantic-core==2.20.1
  Using cached pydantic_core-2.20.1.tar.gz (388 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
          Updating crates.io index
      error: failed to get `ahash` as a dependency of package `pydantic-core v2.20.1 (/tmp/pip-install-313nz3kj/pydantic-core_65a6b7ec56b14a10b925e210d3c920fb)`
      
      Caused by:
        failed to fetch `https://github.com/rust-lang/crates.io-index`
      
      Caused by:
        network failure seems to have happened
        if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
        https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
      
      Caused by:
        SSL error: unknown error; class=Ssl (16)
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?

I have no idea what to do. It would be very nice if someone could pay my attention to root of the problem or write a solution.

@acquitelol
Copy link

Try putting:

[http]
check-revoke = false

in ~/.cargo/config.toml

@socloseeee
Copy link
Author

socloseeee commented Sep 2, 2024

Try putting:

[http]

check-revoke = false

in ~/.cargo/config.toml

I did that, and then a different type of error appeared.

(venv) localhost:~/HamsterValor# pip install pydan
tic
Collecting pydantic
  Using cached pydantic-2.8.2-py3-none-any.whl.metadata (125 kB)
Collecting annotated-types>=0.4.0 (from pydantic)
  Using cached annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.20.1 (from pydantic)
  Using cached pydantic_core-2.20.1.tar.gz (388 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting typing-extensions>=4.6.1 (from pydantic)
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Using cached pydantic-2.8.2-py3-none-any.whl (423 kB)
Using cached annotated_types-0.7.0-py3-none-any.whl (13 kB)
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Building wheels for collected packages: pydantic-core
  Building wheel for pydantic-core (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pydantic-core (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Running `maturin pep517 build-wheel -i /root/HamsterValor/venv/bin/python --compatibility off`
      📦 Including license file "/tmp/pip-install-6eoxdyg4/pydantic-core_2cbe1d6be195445e903006fe175a4dee/LICENSE"
      🍹 Building a mixed python/rust project
      🔗 Found pyo3 bindings
      🐍 Found CPython 3.10 at /root/HamsterValor/venv/bin/python
      📡 Using build options features, bindings from pyproject.toml
      warning: unused manifest key: lints
      error: package `regex-automata v0.4.7` cannot be built because it requires rustc 1.65 or newer, while the currently active rustc version is 1.60.0
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO CARGO_ENCODED_RUSTFLAGS="-C\u{1f}target-feature=-crt-static" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.10-64bit" PYO3_PYTHON="/root/HamsterValor/venv/bin/python" PYTHON_SYS_EXECUTABLE="/root/HamsterValor/venv/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-6eoxdyg4/pydantic-core_2cbe1d6be195445e903006fe175a4dee/Cargo.toml" "--release" "--lib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/root/HamsterValor/venv/bin/python', '--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 pydantic-core
Failed to build pydantic-core
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pydantic-core)

@acquitelol
Copy link

acquitelol commented Sep 2, 2024

I mean, the issue is right there

error: package `regex-automata v0.4.7` cannot be built because it requires rustc 1.65 or newer, while the currently active rustc version is 1.60.0

Alpine 3.16 only has Rust version 1.60.0, most packages require at the bare minimum 1.65.0 nowadays though

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