-
-
Notifications
You must be signed in to change notification settings - Fork 443
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
Can’t build matplotlib as a flake (something about certifi) #280
Comments
Maybe related to #271? |
Related: #42 (comment) This should be fixed with this override: matplotlib = super.matplotlib.overridePythonAttrs (
old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.certifi ];
}
); The build still fails for matplotlib >= 3.4.0 because it now tries to download Qhull during the build. It is possible to use a system version, but the current nixpkgs package is at version 2016.1, which is too old. We need at least version 2020.2. |
Thanks a lot for the pointers! I got it to build, here is how:
Would it be ok to somehow override system libraries in this repository? E.g. provide |
Thanks for working on this. I would recommend that you first update After that I don't know what the poetry2nix policy on depending on specific nixpkgs versions is. Maybe we can just assume that we have the latest nixpkgs and then release a new poetry2nix version. Maybe adding an override is the preferred approach. I think that decision would be up to @adisbladis. |
In case others wonder how exactly to put in place the solution given by @kirelagin : let
qhullOverlay = self: super:
{
# Update Qhull to a recent version because Nixpkgs only has the 2016 version
qhull = super.qhull.overrideAttrs (old: {
src = super.fetchFromGitHub {
owner = "qhull";
repo = "qhull";
rev = "d0e8064088e0d51f7df9b380b22d66a3c6ba0c9a";
# If you don't know the hash, the first time, set:
# sha256 = "0000000000000000000000000000000000000000000000000000";
# then nix will fail the build with such an error message:
# hash mismatch in fixed-output derivation '/nix/store/m1ga09c0z1a6n7rj8ky3s31dpgalsn0n-source':
# wanted: sha256:0000000000000000000000000000000000000000000000000000
# got: sha256:173gxk0ymiw94glyjzjizp8bv8g72gwkjhacigd1an09jshdrjb4
sha256 = "0g009w5mzidxgvj6p90gd7rrhp325cslmgfd5b64vrxqjswcpydk";
};
});
};
in
{ pkgs ? import <nixpkgs> { overlays = [ qhullOverlay ]; }
}:
pythonEnv = poetry2nix.mkPoetryEnv {
projectDir = ./path/to/your/python/project;
overrides =
poetry2nix.overrides.withDefaults
(
self: super: {
matplotlib = super.matplotlib.overrideAttrs (old: {
# Add the Python `certifi` dep and the system `qhull` dep
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.certifi pkgs.qhull ];
# Tell Matplotlib to use the system Qhull
postPatch = ''
cat > setup.cfg <<EOF
[libs]
system_freetype = True
system_qhull = True
EOF
'';
});
}
);
}; There may be cleaner/better solutions but hey, at least it works 😄 |
yeah we should have a bot that updates the flake to track unstable, like it is going to be done in home-manager. I've submitted a PR for qhull. As for fixing poetry2nix, it's a matter of updating the flake and nixpkgs if we want matplotlib > 0.3.4 |
Thank you for working on this @teto :) This issue was closed by a keyword in the qhull update commit message. I think it should remain open for now since the override isn't added to the default overrides yet and the nixpkgs version situation is not resolved. We should at least wait unti the qhull update is in |
yeah i was surprised to see it closed but that's automation for your :) agreed. |
Dunno why it got closed and why I got subscribed to this ticket. I just pushed the most recent nixpkgs commits to my own nixpkgs fork. I'll reopen. |
Thanks for reopening. I think this happened because the commit contained the "fix" keyword which triggered the close once somebody with the necessary permission (you) pushed it to a repository. |
I've tried @kirelagin's solution but get a really weird error: nix log
Somehow nuke-references is destroying all the library paths? And qhull's path is not even included in the compiler invocation... I'm using the following override: matplotlib = prev.matplotlib.overrideAttrs (old: {
# Add the Python `certifi` dep and the system `qhull` dep
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ final.certifi qhull ];
# Tell Matplotlib to use the system Qhull
postPatch = ''
cat > setup.cfg <<EOF
[libs]
system_freetype = True
system_qhull = True
EOF
'';
});
|
I was wondering why I had matplotlib failing even with
(and nixpkgs unstable builds matplotlib 3.4.1 with the certifi/qhull fixes) but the poetry2nix overrides overwrite the nix package so it needs to be overriden too
The poetry2nix flake is getting old though so I wouldn't mind a bump there. |
It seems to me that this issue is fixed in all supported nixpkgs versions. |
Please, see kirelagin/p2n-matplotlib for a reproduction – it is a fresh Poetry project depending only on
matplotlib
+ a flake usingpoetry2nix
master.When I try to
nix build
it, I get:Full build log
I don’t understand what it means, but I tried adding
certifi
to the dependencies and doingnix build --impure
– still the same.The text was updated successfully, but these errors were encountered: