-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
JAX ecosystem: jaxlib
should never be in propagatedBuildInputs
#156808
Conversation
Result of 7 packages failed to build:
11 packages built:
|
I'm not worried about python310 failures as that entire package set is mostly broken atm. cc @Mic92 for any thoughts? |
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.
Please report these issues also with the upstream users of jaxlib so they can fix their requirements.
For the packages that explicitly depend on |
@ndl If that's the case it would certainly make my life easier, and does seem cleaner on the nix side of things. I'll give it a shot and see if I can get it to work! |
5a85f26
to
93f88be
Compare
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.
LG, thanks for fixing this!
Thanks @ndl! I'll merge tomorrow unless anyone objects |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/petition-to-build-and-cache-unfree-packages-on-cache-nixos-org/17440/1 |
This is not the solution to go with! If people want to use a different version of jaxlib they can resort to python's package overrides. |
@dotlambda there are two main problems with overrides/overlays:
|
neither does the unfree jaxlibWithCuda
And people easily get that freedom: let
python = python3.override {
packageOverrides = self: super: {
jaxlib = self.jaxlibWithCuda;
};
};
in python.pkgs.elegy I suggest that this is put in the wiki instead of the current solution. |
True, although this makes things much easier for end users maintaining their own CI infrastructure. For example, nixpkgs-upkeep builds
Overlays are a constant source of confusion for users (see eg https://discourse.nixos.org/t/what-are-overlays/14680), and are not nearly as ergonomic as simply By the way, there is extensive precedent for this pattern in nixpkgs already: |
FWIW I've actually used the overlay / override solution in the past for a locally-maintained CUDA version of
@dotlambda are there any particular issues that you see with this approach that outweigh the advantages listed above? |
Any package that depends on a package that depends on a package that ... that uses jax needs to have jaxlib in its buildInputs.
If you want to be able to switch out packages without rebuilding its reverse dependencies (like upstream wants you to be able to) then you should use something other than Nix. |
I don't feel like this is a practical solution to any user's problems. I feel as though the message here has devolved a bit into "no, not that way" without offering an alternative solution that actually meets our needs. As maintainers (and users!) of the JAX ecosystem, @ndl and I have found a solution that works very very well for us. I'm open to entertaining alternative designs to meet our specific needs, but we need concrete ideas not just "don't do it". |
Right now I think the split is actually closer to 50 / 50: 4 packages ( |
What about using
|
This is a debate between purity and convenience and I'd go with purity because I don't wanna be hit by bad decisions later on. |
This means every package in the JAX ecosystem ever. It's just too much. Even forgetting about the compute costs, it would make CI much messier. Especially considering that upstream was very intentional in making the design decision to avoid this problem. Bear in mind that we've only been considering the CPU and GPU versions of jaxlib, but there's a TPU version as well that's not even packaged yet! As new specialized DL hardware is developed other versions will likely be created as well.
As with any software project, it's always possible that we may run into unforeseen complications in the future. And if/when that happens, I think it would be a more appropriate time to have this conversation. The current design works well for the road bumps that we've hit up to this point. And as @ndl mentioned, the modularity of our current design is strictly more flexible than putting |
Motivation for this change
Fix #156767.
There are multiple possible "versions" of the jaxlib package: CPU-only, CUDA-enabled, and TPU-enabled. Currently the jaxlib package defaults to the smallest (and most FOSS) version which is CPU-only. CUDA support can be enabled by end users via the
cudaSupport = true
option.This presents an issue when using packages that depend on jax/jaxlib however. If the packages depend directly on jaxlib by adding them to
propagatedBuildInputs
then the end-user is stuck with the CPU-only version of jaxlib, even though the CUDA version may be desired. Using overlays is one possible workaround but unfortunately that requires every end-user to recompile the entire JAX ecosystem locally whenever they want to use a non-CPU jaxlib.This PR removes jaxlib from any and all
propagatedBuildInputs
and patches packages that require jaxlib as asetup.py
dependency. AFAIU this is in line with the JAX authors' intention to separate the jax and jaxlib packages. In fact, jax itself does not even have asetup.py
dependency on jaxlib.For future debugging purposes, an easy way to test if you have conflicting jaxlib versions is
This command should return at most one entry at all times. I've verified that the changes in this PR do in fact resolve this issue based on the shell.nix used in #156767.
Assuming we reach consensus that this is the right path forward, I will document this practice on the wiki page.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes