Skip to content

Can't cross compile to windows "cannot set a minimum Python version 3.8 higher than the interpreter version 3.7" #2436

@CastilloDel

Description

@CastilloDel

Bug Description

I have a crate that I'm trying to cross compile to windows using:

maturin build --target x86_64-pc-windows-gnu --release

and it fails with

2025-01-13T09:20:49.800386Z  INFO into_build_context: maturin::build_options: close time.busy=1.62µs time.idle=5.93µs
2025-01-13T09:20:49.800528Z DEBUG maturin::project_layout: Found pyproject.toml in working directory at "/home/xxxx/xxxx/xxx-client-python/pyproject.toml"
2025-01-13T09:20:49.800950Z DEBUG maturin::project_layout: Using cargo manifest path from working directory: "/home/xxxx/xxxx/xxx-client-python/Cargo.toml"
2025-01-13T09:20:49.801616Z DEBUG resolve_cargo_metadata: maturin::project_layout: Resolving cargo metadata from "/home/xxxx/xxxx/xxx-client-python/Cargo.toml"
2025-01-13T09:20:50.127090Z  INFO resolve_cargo_metadata: maturin::project_layout: close time.busy=325ms time.idle=1.60µs
2025-01-13T09:20:50.127541Z DEBUG maturin::project_layout: Project layout resolved project_root=/home/xxxx/xxxx/xxx-client-python python_dir=/home/xxxx/xxxx/xxx-client-python rust_module=/home/xxxx/xxxx/xxx-client-python/xxxx python_module=/home/xxxx/xxxx/xxx-client-python/xxxx extension_name=xxxx module_name=xxxx
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.8
🐍 Not using a specific python interpreter (automatically generating windows import library)
2025-01-13T09:20:50.187353Z DEBUG build_wheels: maturin::compile: Running env -u CARGO PYO3_CONFIG_FILE="/home/xxxx/xxxx/target/maturin/pyo3-config-x86_64-pc-windows-gnu-3.7.txt" "cargo" "rustc" "--target" "x86_64-pc-windows-gnu" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/xxxx/xxxx/xxx-client-python/Cargo.toml" "--release" "--lib"
   Compiling zerovec v0.10.4
   Compiling pyo3-build-config v0.23.3
   Compiling version_check v0.9.5
   Compiling tower-layer v0.3.3
   Compiling atomic-waker v1.1.2
   Compiling serde v1.0.216
   Compiling rustversion v1.0.18
   Compiling indexmap v1.9.3
error: failed to run custom build command for `pyo3-build-config v0.23.3`

Caused by:
  process didn't exit successfully: `/home/xxxx/xxxx/target/release/build/pyo3-build-config-ae3b6beb0c714554/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
  cargo:rerun-if-changed=/home/xxxx/xxxx/target/maturin/pyo3-config-x86_64-pc-windows-gnu-3.7.txt

  --- stderr
  error: cannot set a minimum Python version 3.8 higher than the interpreter version 3.7 (the minimum Python version is implied by the abi3-py38 feature)
warning: build failed, waiting for other jobs to finish...
2025-01-13T09:20:53.137270Z  INFO build_wheels: maturin::build_context: close time.busy=2.95s time.idle=1.59µs
💥 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_CONFIG_FILE="/home/xxxx/xxxx/target/maturin/pyo3-config-x86_64-pc-windows-gnu-3.7.txt" "cargo" "rustc" "--target" "x86_64-pc-windows-gnu" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/xxxx/xxxx/xxx-client-python/Cargo.toml" "--release" "--lib"`

Some relevant parts of the Cargo.toml:

pyo3 = { version = "0.23", features = ["extension-module", "generate-import-lib", "abi3-py38"] }
pyo3-async-runtimes = { version = "0.23", features = ["tokio-runtime"] }

It seems very misleading, because it mentions python3.7, when I'm not using or specifying that version anywhere. It seems that while it says Not using a specific python interpreter (automatically generating windows import library) it's using 3.7 to some extent under the hood. The same configuration used to work with a lower version of PyO3, I'm not sure if I should report it there.

Your maturin version (maturin --version)

1.8.1

Your Python version (python -V)

Python 3.12.3

Your pip version (pip -V)

pip 24.0

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

maturin build --target x86_64-pc-windows-gnu --release

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions