Pip lists package as outdated but updating results in Requirement already satisfied

Solved using sudo pip install -U <package>

So when I do pip list --outdated I get:

Package           Version     Latest Type
----------------- ----------- ------ -----
anyio             3.3.3       3.3.4  wheel
cffi              1.14.6      1.15.0 wheel
contextlib2       0.6.0.post1 21.6.0 wheel
idna              3.2         3.3    wheel
ipywidgets        7.6.3       7.6.5  wheel
jsonschema        3.2.0       4.1.0  wheel
jupyter-client    6.1.12      7.0.6  wheel
keyring           23.0.1      23.2.1 wheel
matplotlib-inline 0.1.2       0.1.3  wheel
nbconvert         6.1.0       6.2.0  wheel
packaging         20.9        21.0   wheel
pandocfilters     1.4.3       1.5.0  wheel
pip               20.3.4      21.3   wheel
PyGObject         3.40.1      3.42.0 sdist
pyOpenSSL         20.0.1      21.0.0 wheel
pytz              2021.1      2021.3 wheel
pyzmq             22.2.1      22.3.0 wheel
resolvelib        0.5.5       0.8.1  wheel
setuptools        57.4.0      58.2.0 wheel
sip               4.19.25     6.3.1  wheel
terminado         0.11.1      0.12.1 wheel
trimesh           3.9.31      3.9.32 wheel
websocket-client  0.59.0      1.2.1  wheel

then when I do pip install anyio -U to update the first package I get:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: anyio in ./.local/lib/python3.9/site-packages (3.3.4)
Requirement already satisfied: idna>=2.8 in ./.local/lib/python3.9/site-packages (from anyio) (3.3)
Requirement already satisfied: sniffio>=1.1 in /usr/lib/python3.9/site-packages (from anyio) (1.2.0)

As I understand the package is already updated, but pip still lists the package as outdated and also doesn’t list it in the updated package list.

What is going on?

Answer

See this, and as you can guess the problem here is Defaulting to user installation because normal site-packages is not writeable which relates to some permission related issues which I am not sure of.

You can use here python3 -m pip install -U <package>.

A stable solution could be to reinstall python from scratch in your system.