Skip to content

python3Packages.setuptools-rust: fix python version inconsistency#473299

Merged
Aleksanaa merged 2 commits intoNixOS:staging-nextfrom
Aleksanaa:setuptools-rust-fix
Dec 23, 2025
Merged

python3Packages.setuptools-rust: fix python version inconsistency#473299
Aleksanaa merged 2 commits intoNixOS:staging-nextfrom
Aleksanaa:setuptools-rust-fix

Conversation

@Aleksanaa
Copy link
Member

@Aleksanaa Aleksanaa commented Dec 22, 2025

Fixes #467817 (comment)

The default version of python is incorrectly introduced here, instead of the correct one corresponding to python3Packages.
This is causing python312Packages.bcrypt to fail in staging-next, and potentially other packages, because pyo3 tries to use a higher version than current system, resulting in incompatible symbols.

staging-next: #471587

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@Aleksanaa Aleksanaa requested a review from DavHau December 22, 2025 14:30
@nixpkgs-ci nixpkgs-ci bot requested review from mweinelt and natsukium December 22, 2025 14:31
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 6.topic: python Python is a high-level, general-purpose programming language. labels Dec 22, 2025
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Dec 22, 2025
@Aleksanaa
Copy link
Member Author

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.targetPackages.python3
«derivation /nix/store/ppqzglhrycgyj5965kc5nrs350j00bhv-python3-aarch64-unknown-linux-gnu-3.13.9.drv»

nix-repl> pkgsCross.aarch64-multiplatform.buildPackages.python3Packages.python.pythonOnTargetForTarget
«derivation /nix/store/zzw607vas5hjvsrfw4xrl2p6ncksldka-python3-aarch64-unknown-linux-gnu-3.13.11.drv»

Should not break cross

@Aleksanaa
Copy link
Member Author

python3.13-word-count is failing for unrelated reason

error: trailing semicolon in macro used in expression position
   --> build.rs:23:87
    |
 23 |     ($fmt: literal $(, $args: expr)+) => { return Err(format!($fmt $(,$args)+).into()); };
    |                                                                                       ^
...
125 |             bail!("{} value of {:?} does not exist", var, path)
    |             --------------------------------------------------- in this macro invocation
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
    = note: macro invocations at the end of a block are treated as expressions
    = note: to ignore the value produced by the macro, add a semicolon after the invocation of `bail`
    = note: this error originates in the macro `bail` (in Nightly builds, run with -Z macro-backtrace for more info)
error: trailing semicolon in macro used in expression position
   --> build.rs:23:87
    |
 23 |       ($fmt: literal $(, $args: expr)+) => { return Err(format!($fmt $(,$args)+).into()); };
    |                                                                                         ^
...
383 | /         bail!(
384 | |             "Detected multiple possible python versions, please set the PYO3_PYTHON_VERSION \
385 | |             variable to the wanted version on your system\nsysconfigdata paths = {:?}",
386 | |             sysconfig_paths
387 | |         )
    | |_________- in this macro invocation
    |

@Aleksanaa
Copy link
Member Author

@ofborg build python312Packages.bcrypt python313Packages.bcrypt python314Packages.bcrypt

@Aleksanaa Aleksanaa added this pull request to the merge queue Dec 23, 2025
Merged via the queue into NixOS:staging-next with commit a48f11c Dec 23, 2025
36 of 42 checks passed
@Aleksanaa Aleksanaa deleted the setuptools-rust-fix branch December 23, 2025 03:35
@trofi
Copy link
Contributor

trofi commented Dec 25, 2025

Bisect says that the change caused the eval failure for pkgsLLVM.python3Packages.setuptools-rust in staging and staging-next as:

$ nix-instantiate -A pkgsLLVM.python3Packages.setuptools-rust
error:
       … while evaluating the attribute 'drvPath'
         at lib/customisation.nix:446:7:
          445|     // {
          446|       drvPath =
             |       ^
          447|         assert condition;

       … while evaluating the attribute 'drvPath'
         at lib/customisation.nix:446:7:
          445|     // {
          446|       drvPath =
             |       ^
          447|         assert condition;

       … while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: cannot coerce a set to a string: { }

@Aleksanaa
Copy link
Member Author

It's pkgsLLVM.python3.pythonOnTargetForTarget. I'm looking into why that happens

@Aleksanaa
Copy link
Member Author

Okay I know, for some reasons, pkgsTargetTarget is not empty, but targetPackages is, and pkgsLLVM.pkgsTargetTarget is also empty.

@Aleksanaa
Copy link
Member Author

This is because pkgs is not __splicedPackages... surprise

# targetPackages.python3 is not always available, for example when including
# setuptools-rust via buildInputs instead of nativeBuildInputs or building it directly.
setupHook =
if !(targetPackages ? python3) then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous workaround is still needed, I'll add it back

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

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 2501-5000 This PR causes many rebuilds on Darwin and should target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants