doc/python: Demonstrate how to override the blas implementation
This commit is contained in:
parent
8e5efa270f
commit
5262a7d1c9
1 changed files with 22 additions and 2 deletions
|
@ -1185,8 +1185,7 @@ following are specific to `buildPythonPackage`:
|
||||||
variables which will be available when the binary is run. For example,
|
variables which will be available when the binary is run. For example,
|
||||||
`makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
|
`makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
|
||||||
* `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this
|
* `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this
|
||||||
defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications
|
defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications to `""`.
|
||||||
to `""`.
|
|
||||||
* `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip
|
* `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip
|
||||||
install`. To pass options to `python setup.py install`, use
|
install`. To pass options to `python setup.py install`, use
|
||||||
`--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`.
|
`--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`.
|
||||||
|
@ -1244,6 +1243,27 @@ with import <nixpkgs> {};
|
||||||
in python.withPackages(ps: [ ps.blaze ])).env
|
in python.withPackages(ps: [ ps.blaze ])).env
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The next example shows a non trivial overriding of the `blas` implementation to
|
||||||
|
be used through out all of the Python package set:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
python3MyBlas = pkgs.python3.override {
|
||||||
|
packageOverrides = self: super: {
|
||||||
|
# We need toPythonModule for the package set to evaluate this
|
||||||
|
blas = super.toPythonModule(super.pkgs.blas.override {
|
||||||
|
blasProvider = super.pkgs.mkl;
|
||||||
|
});
|
||||||
|
lapack = super.toPythonModule(super.pkgs.lapack.override {
|
||||||
|
lapackProvider = super.pkgs.mkl;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
This is particularly useful for numpy and scipy users who want to gain speed with other blas implementations.
|
||||||
|
Note that using simply `scipy = super.scipy.override { blas = super.pkgs.mkl; };` will likely result in
|
||||||
|
compilation issues, because scipy dependencies need to use the same blas implementation as well.
|
||||||
|
|
||||||
#### Optional extra dependencies {#python-optional-dependencies}
|
#### Optional extra dependencies {#python-optional-dependencies}
|
||||||
|
|
||||||
Some packages define optional dependencies for additional features. With
|
Some packages define optional dependencies for additional features. With
|
||||||
|
|
Loading…
Reference in a new issue