pip upgrade downloading every previous version until storage is full

On CentOS 7, I am trying to upgrade awscli:

/usr/bin/python3 -m pip install awscli --upgrade --user

Why is this downloading every single previous version, until there is finally no space left on device?

Requirement already satisfied: awscli in
/root/.local/lib/python3.6/site-packages (1.18.196) Collecting awscli
Downloading awscli-1.18.197-py2.py3-none-any.whl (3.5 MB)
Downloading awscli-1.18.197.tar.gz (1.4 MB) Using cached
awscli-1.18.196-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.196.tar.gz (1.4 MB) Using cached
awscli-1.18.195-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.195.tar.gz (1.4 MB) Using cached
awscli-1.18.194-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.194.tar.gz (1.4 MB) Using cached
awscli-1.18.193-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.193.tar.gz (1.4 MB) Using cached
awscli-1.18.192-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.192.tar.gz (1.4 MB) Using cached
awscli-1.18.191-py2.py3-none-any.whl (3.5 MB) Downloading
awscli-1.18.191.tar.gz (1.4 MB) Using cached
awscli-1.18.190-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.190.tar.gz (1.4 MB) Downloading
awscli-1.18.189-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.189.tar.gz (1.4 MB) Downloading
awscli-1.18.188-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.188.tar.gz (1.4 MB) Downloading
awscli-1.18.187-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.187.tar.gz (1.4 MB) Downloading
awscli-1.18.186-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.186.tar.gz (1.4 MB) Using cached
awscli-1.18.185-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.185.tar.gz (1.4 MB) Downloading
awscli-1.18.184-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.184.tar.gz (1.4 MB) Using cached
awscli-1.18.183-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.183.tar.gz (1.4 MB) Using cached
awscli-1.18.182-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.182.tar.gz (1.4 MB) Using cached
awscli-1.18.181-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.181.tar.gz (1.4 MB) Using cached
awscli-1.18.180-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.180.tar.gz (1.4 MB) Using cached
awscli-1.18.179-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.179.tar.gz (1.4 MB) Using cached
awscli-1.18.178-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.178.tar.gz (1.4 MB) Using cached
awscli-1.18.177-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.177.tar.gz (1.3 MB) Using cached
awscli-1.18.176-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.176.tar.gz (1.3 MB) Downloading
awscli-1.18.175-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.175.tar.gz (1.3 MB) Using cached
awscli-1.18.174-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.174.tar.gz (1.3 MB) Using cached
awscli-1.18.173-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.173.tar.gz (1.3 MB) Using cached
awscli-1.18.172-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.172.tar.gz (1.3 MB) Using cached
awscli-1.18.171-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.171.tar.gz (1.3 MB) Downloading
awscli-1.18.170-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.170.tar.gz (1.3 MB) Downloading
awscli-1.18.169-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.169.tar.gz (1.3 MB) Downloading
awscli-1.18.168-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.168.tar.gz (1.3 MB) Using cached
awscli-1.18.167-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.167.tar.gz (1.3 MB) Using cached
awscli-1.18.166-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.166.tar.gz (1.3 MB) Using cached
awscli-1.18.165-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.165.tar.gz (1.3 MB) Using cached
awscli-1.18.164-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.164.tar.gz (1.3 MB) Using cached
awscli-1.18.163-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.163.tar.gz (1.3 MB) Using cached
awscli-1.18.162-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.162.tar.gz (1.3 MB) Using cached
awscli-1.18.161-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.161.tar.gz (1.3 MB) Using cached
awscli-1.18.160-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.160.tar.gz (1.3 MB) Using cached
awscli-1.18.159-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.159.tar.gz (1.3 MB) Using cached
awscli-1.18.158-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.158.tar.gz (1.3 MB) Using cached
awscli-1.18.157-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.157.tar.gz (1.3 MB) Using cached
awscli-1.18.156-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.156.tar.gz (1.3 MB) Using cached
awscli-1.18.155-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.155.tar.gz (1.3 MB) Using cached
awscli-1.18.154-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.154.tar.gz (1.3 MB) Downloading
awscli-1.18.153-py2.py3-none-any.whl (3.4 MB) Using cached
awscli-1.18.153.tar.gz (1.3 MB) Using cached
awscli-1.18.152-py2.py3-none-any.whl (3.4 MB) Downloading
awscli-1.18.152.tar.gz (1.3 MB) Using cached
awscli-1.18.151-py2.py3-none-any.whl (3.3 MB) Downloading
awscli-1.18.151.tar.gz (1.3 MB) Using cached
awscli-1.18.150-py2.py3-none-any.whl (3.3 MB) Downloading
awscli-1.18.150.tar.gz (1.3 MB) Using cached
awscli-1.18.149-py2.py3-none-any.whl (3.3 MB) Downloading
awscli-1.18.149.tar.gz (1.3 MB) Using cached
awscli-1.18.148-py2.py3-none-any.whl (3.3 MB) Downloading
awscli-1.18.148.tar.gz (1.3 MB) Using cached
awscli-1.18.147-py2.py3-none-any.whl (3.3 MB) Downloading
awscli-1.18.147.tar.gz (1.3 MB) Using cached
(...)
awscli-1.16.41-py2.py3-none-any.whl (1.4 MB) Downloading
awscli-1.16.41.tar.gz (636 kB) Downloading
awscli-1.16.40-py2.py3-none-any.whl (1.4 MB) Downloading
awscli-1.16.40.tar.gz (636 kB) Downloading
awscli-1.16.39-py2.py3-none-any.whl (1.4 MB) Downloading
awscli-1.16.39.tar.gz (636 kB) Downloading
awscli-1.16.38-py2.py3-none-any.whl (1.4 MB) Downloading
awscli-1.16.38.tar.gz (636 kB) ERROR: Could not install packages due
to an EnvironmentError: [Errno 28] No space left on device:
'/tmp/pip-install-d05v14o4/awscli_799b59c34d714e6abf8745c33231bad6/awscli/examples/ec2/create-vpc-endpoint-connection-notification.rst'

I have uninstalled and re-installed it. Works well when I do that way.
But I don't understand why upgrading causes it to download every other version.


Solution 1:

Apparently the reason is this: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html

A new dependency resolver was released, and it's obviously causing this ridiculous infinite loop downloading all previous versions.

The article above mentions that You can use the deprecated (old) resolver, using the flag --use-deprecated=legacy-resolver, until we remove it in the pip 21.0 release in January 2021.

So, this resolved the problem for me:

/usr/bin/python3 -m pip install awscli --upgrade --user --use-deprecated=legacy-resolver

... until January 2021!


Edit: This is actually fixed in the newest version of "pip":

/usr/bin/python3 -m pip install 'pip==20.3.3'

I had to specify "20.3.3", as otherwise the same infinite loop was happening trying to upgrade pip.