0

Why are there so many versions and locations of pip?

When I run pip install -U pip it says it's updating to a newer version, then when I run pip --version it's the un-updated version. I am on WSL.

so many pips...

j7skov
  • 557
  • 7
  • 22
  • No screenshots of text (or code)! Instead copy-paste the text into your question. – sinoroc Jan 05 '23 at 09:39
  • https://snarky.ca/why-you-should-use-python-m-pip/ – sinoroc Jan 05 '23 at 09:40
  • @sinoroc I've now installed pyenv and cannot get this original text back... but I tried. Also found that `/usr/bin/pip[3]` and `/bin/pip[3]` point to `/home/ubuntu/.local/lib/python3.8/site-packages/pip` while `/home/ubuntu/.local/bin/pip[3]` points to `/home/ubuntu/.local/lib/python3.8/site-packages/pip`... so looks like I only have 2 versions installed actually. – j7skov Jan 05 '23 at 12:51
  • If I were you I would uninstall all _pip_ installations, and only use the _pip_ that comes in virtual environments, this is how I do it. -- Probably you need to figure out how to cleanly uninstall the local installations at `/home/ubuntu/.local/bin/pip*`, and then uninstall the global installations, probably with something like `sudo apt autoremove python-pip`, not sure exactly. -- I do not know how `pyenv` is supposed to help in your case. – sinoroc Jan 05 '23 at 15:29

2 Answers2

0

You can add the following to the command you are running to open Python, then upgrade pip through it's module.

EDIT: for clarification When Running the script for example in vscode or wsl your command will be the direct path to your specific python install. So whatever way you are starting the python script just adjust it to use pip upgrade

e.g.

/bin/Python3.10/python pythonScript.py

would be

/bin/Python3.10/python -m pip install --upgrade pip

Otherwise, you will need to update your Environmental Variables in WSL to use a certain version of python with 'python' and a certain pip with 'pip3'

EDIT2: Also VENV may help your situation :)

harrison
  • 1
  • 2
0

I think you have multiple Python version installed on the same machine, if this is the case try using pipx.x install --upgrade pip where x.x is the Python version you want to use.

As far as I know each Python installation has its own pip, so you need to select a specific version.

Then there is the system interpreter, which is the default Python version run by your terminal and this is the version used when you simply use pip without any x.x version selection.

See if this solves your issue.

Matteo
  • 21
  • 5