-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
python3Packages: don't propagate numpy_1 if also numpy_2 is supported #338334
Conversation
What's the issue with using |
Even in the context of private nix shells, I don't want to rebuild Scipy and/or Matplotlib, and a few other slightly heavy to build packages just because I want to use them with Numpy 2. Also, I want to contribute a package to Nixpkgs that requires both |
You wouldn't have to once there is a top-level package in Nixpkgs using the same overrides so Hydra builds them. |
Is that because SciPy doesn't yet support NumPy 2? |
Scipy does support Numpy 2: https://github.com/scipy/scipy/blob/v1.14.1/pyproject.toml#L32-L39
If I understand you correctly, then you are supporting the idea of #327437 , which I got convinced is not that good. |
No. I suggest you add a top-level package (outside of
|
OK I understand you now, but the package I was talking about is a Python package I want to add to |
You can still add it but set something like |
I think I failed to explain to you the situation. Let's talk about that Python package I want to add in a less hypothetical environment, at #327446 - try to solve that dependency nightmare with what ever idea you have in mind.
That's indeed a nice idea but I am not able to imagine how would you do that. I will say though that I liked the idea of adding to BTW I tested that Scipy builds with this change applied on master so I'm marking this as non-draft. A very similar change to this was done in #323171 - a Python package that explicitly states that it supports two variants of one of its dependencies, shouldn't propagate only 1 of them. |
@@ -14204,7 +14204,9 @@ self: super: with self; { | |||
|
|||
scikit-tda = callPackage ../development/python-modules/scikit-tda { }; | |||
|
|||
scipy = callPackage ../development/python-modules/scipy { }; | |||
scipy = callPackage ../development/python-modules/scipy { | |||
numpy = numpy_2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that within python3Packages
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't do that within
python3Packages
.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a semantic change - I won't mind using numpy_2
directly in scipy/default.nix
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't mind using
numpy_2
directly inscipy/default.nix
.
That's not the issue.
Your change breaks python3.withPackages (ps: with ps; [ numpy scipy ])
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, that's not true.
But it does break python3.withPackages (ps: with ps; [ scipy ])
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, that's not true. But it does break
python3.withPackages (ps: with ps; [ scipy ])
.
OK so what is your opinion on the matter? Use numpy = numpy_2
in python-packages.nix
, or use numpy_2
directly in the scipy/default.nix
expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use numpy
everywhere. And propagate it.
I marked it again as a draft because something is not working currently with scipy and numpy_2 - both dependencies got mixed somehow - headers from numpy_2 were used with shared objects of numpy_1. Should be fixable. |
I'm mostly interested in your view on #327446 . |
6265010
to
3541ac7
Compare
3541ac7
to
6e75b64
Compare
Fixed the nixfmt issue in the last push. |
I'm against moving numpy to buildInputs because I think that the lack of propagation of numpy greatly impacts downstream packages. |
The problem is that only works well if none of your dependencies propagate numpy. |
This is needed since pythran is not propagating numpy anymore.
6e75b64
to
0e9a56e
Compare
Another thing I can try to do, is iterate (with |
Just passing by, but I do agree that this isn't great because it breaks downstream packages, requiring people to add numpy to their own non-Nixpkgs derivations to get them to build again. I can't imagine doing this for all packages with new versions, and from what I can tell, there's nothing special about numpy's new version. I do like @dotlambda's #327446 (comment) to just get a single package for Numpy 2. #339657 also seems nice, I left some comments. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Many Python packages nowadays support both numpy versions, and even when they have components compiled against either, they don't retain references to either numpy, unless of course the numpy used is propagated. Hence it would be nice to enable users to choose either, and not force them to stick them to numpy_1 just because some dependency is propagating numpy_1 and you don't want multiple numpy versions in your nix shell or whatever.
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.