Are there meaningful differences between these three ways of using python packages? Thus far I’ve been using them interchangeably.
EDIT: And not to be forgotten is also python3Packages.foobar
!
Are there meaningful differences between these three ways of using python packages? Thus far I’ve been using them interchangeably.
EDIT: And not to be forgotten is also python3Packages.foobar
!
python3Packages
is aliased to python3.pkgs
, so those are equivalent.
python3.withPackages
will actually do a buildenv and create a python interpreter which “has all the dependencies pre-installed”. You can think of it like creating the nix version of a venv.
Thanks, that makes sense! And I’m assuming pythonPackages.foobar
is python2 only?
if you’re referring to the interpreter, yes
$ nix eval -f . pythonPackages.python.version
"2.7.18"
[22:52:48] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ nix eval -f . python3Packages.python.version
"3.8.7"
it’s pointing to python2 for historical reasons
So if I want to be able to use ipython
in the normal user session (without nix-shell
), and I want to have all stated libraries available, I guess I need to use pythonX.withPackages
in the system or user configuration. Is that so?
Yes. If you want to install it as part of the “system”, please refer to nixpkgs/doc/languages-frameworks/python.section.md at d1f97a5eb5115289071d8449f26e7b92ce6b6709 · NixOS/nixpkgs · GitHub
python3Packages
is aliased topython3.pkgs
So, which one should i use? Will the other one get deprecated soon?
I don’t think there’s plans to deprecate pythonXPackages
, as it’s widely used, and I think makes the package set more discoverable (but I believe @fridh has brought up deprecating it in the past). pythonX.pkgs
will always be there as it’s necessary to create the package sets parameterized for a given interpreter.