-
I am trying to use crane to build the minimum rust-from-python example that PyO3 provides. My
I'm seeing the following error from
What I expect is happening is that PyO3 is not detecting the Python version. I have considered potentially using the PyO3 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Wulfsta! I think the problem is that the 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 src;
buildInputs = with pkgs; [
python3
];
};
in {
# Rest of flake...
} # The second way is to create a set of common arguments and pass
# them to all derivations (after adding any necessary additions).
let
src = ./.;
commonArgs = {
inherit src;
buildInputs = with pkgs; [
python3
];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
py-test = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
});
in {
# Rest of flake...
} The README was recently updated to show the second method if you want to see a more complete example. Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi @Wulfsta! I think the problem is that the
py-test
derivation does not automatically inherit thebuildInputs
defined on thecargoArtifacts
derivation. In other words, thepython3
input is completely missing as far as thepy-test
derivation is concerned.There are two ways to go about fixing this: