Poetry2nix - WARNING: You are using pip version 20.2.4;

How can I get rid of this warning?

What I did is setting up a minimal flake:

$ nix flake init -t github:serokell/templates#python-poetry2nix
* edit flake.nix (description and packageName)
$ nix run nixpkgs#poetry -- init
$ nix run nixpkgs#poetry -- lock
* git add & commit files

Now, whenever I:

$ nix develop

I get the warning about the outdated pip version:

Executing pipShellHook
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /home/damn/Development/htab/hubd
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9 -m pip install --upgrade pip' command.
Finished executing pipShellHook

I’ve tried to find the reason with why-depends:

PIP=$(nix path-info $(which pip))
for i in $(echo $PATH | tr ':' '\n' | grep nix.store); do
   nix why-depends $PIP $i;
done 2>&1 | grep -v does.not.depend

Giving me:

/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4
└───bin/.pip-wrapped: …#!/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9.# -…
    → /nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6
/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4
└───bin/.pip-wrapped: …tools;sys.argv[0] = '/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/bin/pip';f…
    → /nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4
/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4
└───bin/pip: …#! /nix/store/a54wrar1jym1d8yvlijq0l2gghmy8szz-bash-5.1-p12/bin/bash -e.export…
    → /nix/store/a54wrar1jym1d8yvlijq0l2gghmy8szz-bash-5.1-p12

Why do bash and python3 (runtime?) depend on this old pip?

Thanks for helping a newbie,
Daniel

The perceived age totally depends on the branch you are looking at:

$ nix shell nixpkgs/master#python39Packages.pip -c pip --version
pip 21.1.3 from /nix/store/7npqbgf72pcr7y71b0x8cm6z5y0lfq7w-python3.9-pip-21.1.3/lib/python3.9/site-packages/pip (python 3.9)
$ nix shell nixpkgs/nixos-unstable#python39Packages.pip -c pip --version
pip 21.1.3 from /nix/store/7npqbgf72pcr7y71b0x8cm6z5y0lfq7w-python3.9-pip-21.1.3/lib/python3.9/site-packages/pip (python 3.9)
$ nix shell nixpkgs/nixos-21.11#python39Packages.pip -c pip --version
pip 21.1.3 from /nix/store/dxwml8hlaan4rinp1c98jd1wa8ys7723-python3.9-pip-21.1.3/lib/python3.9/site-packages/pip (python 3.9)
$ nix shell nixpkgs/nixos-21.05#python39Packages.pip -c pip --version
pip 21.0.1 from /nix/store/vc8skfr61dzna9ca2asyp12mpd5n43a1-python3.9-pip-21.0.1/lib/python3.9/site-packages/pip (python 3.9)
$ nix shell nixpkgs/nixos-20.09#python39Packages.pip -c pip --version
pip 20.1.1 from /nix/store/124shncl4zs2k5yihfjn8cc6hy6nj5w3-python3.9-pip-20.1.1/lib/python3.9/site-packages/pip (python 3.9)

So if you want a newer pip, you need to use it from another channel.

1 Like

nixpkgs points to the master branch:

...
    nixpkgs.url = "github:NixOS/nixpkgs";
...

Which gives me:

$ nix shell github:NixOS/nixpkgs#python39Packages.pip -c pip --version
pip 21.1.3 from /nix/store/7npqbgf72pcr7y71b0x8cm6z5y0lfq7w-python3.9-pip-21.1.3/lib/python3.9/site-packages/pip (python 3.9)

Any other idea, where the old pip might come from?

Probably from poetry2nix then.

They are probably assuming their default, which hasn’t been updated in a while.

Sadly I currently have no current project that I could check about I usually specify the python and internal tooling.

Quick(est?) way to reproduce:

$ nix flake init -t github:serokell/templates#python-poetry2nix
$ sed -i 's,packageName = .*,packageName = "foo";,' flake.nix
$ nix run nixpkgs#poetry -- init --no-interaction
$ nix run nixpkgs#poetry -- lock
$ nix develop

If anyone wants to give it a shot.