Skip to content

Cannot build crate with PyO3 dependency #30

Answered by ipetkov
Wulfsta asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Wulfsta! I think the problem is that the py-test derivation does not automatically inherit the buildInputs defined on the cargoArtifacts derivation. In other words, the python3 input is completely missing as far as the py-test derivation is concerned.

There are two ways to go about fixing this:

# First way is to explicitly add the build inputs to the `py-test` derivation (and any other derivations which will need it present):
let
  src = ./.;
  cargoArtifacts = craneLib.buildDepsOnly {
    buildInputs = with pkgs; [
      python3
    ];
  };

  # Build the actual crate itself, reusing the dependency
  # artifacts from above.
  py-test = craneLib.buildPackage {
    inherit cargoArtifacts 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Wulfsta
Comment options

@Wulfsta
Comment options

Answer selected by Wulfsta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #29 on May 14, 2022 23:19.