18

I've had to install Python packages and libraries using pip, but every time I do, it says I'm using an older version of pip, and that v18.1 is available by running the command

python -m pip install --upgrade pip

When I run this command, it just says the same thing. It apparently can't update itself because it's outdated. Is there any way to get around this, maybe by manually updating it?

Thanks in advance, community!

Update: The OS I'm using is currently Windows 10 and Python 3.6.4. The following screenshot is what outputs when running the command.

enter image description here

Caleb Hawn
  • 309
  • 1
  • 3
  • 11
  • 4
    Which operating system are you using? I also assume you're using python 2.7 and its pip, can you please confim? – Pitto Oct 25 '18 at 15:05
  • 1
    What version of python are you using? Maybe a fresh install of python would do the trick? – SPYBUG96 Oct 25 '18 at 15:06
  • 1
    If you have both python 2 and 3 installed, it’s possible that you’re only updating pip for the python2 install. You could try pip3 install —upgrade pip – JPeroutek Oct 25 '18 at 15:16
  • 1
    "it just says the same thing" - would be helpful if you included just what exactly *it* says in your question. – PaulMcG Oct 25 '18 at 15:42
  • 2
    Open the command prompt as administrator. – mypetlion Oct 26 '18 at 17:30
  • 1
    Are you an admin? This is a perms issue: your command should work, you just have to run it as an admin. If you're not an admin, you could try to do a wonky user level install of pip (which is both exciting and confusing and I'm not entirely sure it works b/c I've never done it) – Matt Messersmith Oct 26 '18 at 17:37
  • Thanks, @mypetlion and Matt! Running the update command as admin seems to have worked. Now I have to see if the Python program I have to run actually works. – Caleb Hawn Nov 08 '18 at 00:31

4 Answers4

33

Upgrading pip

On Linux or macOS:

pip install -U pip

On Windows:

python -m pip install -U pip
Pitto
  • 8,229
  • 3
  • 42
  • 51
  • I'm on Windows. Nope, that command seems to be the same thing as the "python -m pip install --upgrade pip" command. It still says the same thing. – Caleb Hawn Oct 26 '18 at 17:19
  • 2
    @caleb did you try running the command from an elevated prompt? – Pitto Oct 27 '18 at 19:23
  • An elevated prompt? I'm not sure what that would be, and I'm not sure if it would solve the problem of pip not being able to update itself. The error didn't say it needed any extra permissions or anything. – Caleb Hawn Oct 29 '18 at 00:14
  • 1
    In order to open an elevated prompt you have to right click on the "Command Prompt" aplication and choose "Run as administrator". Please try this and report results while I also investigate for other possible solutions. – Pitto Oct 29 '18 at 10:32
  • 1
    Oh, so basically running as administrator. I don't know if I tried running this command with that yet, so I'll try it. – Caleb Hawn Oct 30 '18 at 14:15
  • 1
    Perfect, @CalebHawn! Please report results so we can keep fighting, if needed. – Pitto Oct 30 '18 at 14:43
  • 2
    Sorry it took so long, @Pitto! I've been busy with school. Running the command as administrator seems to have worked! Now I'm having a problem with the module I'm supposed to have installed. I'm trying to use pip to install the Discord.py module with "pip install discord.py" which says it installed fine, but the "import discord" statement reports a module not found error. Not sure what to do here, or if it's even related. – Caleb Hawn Nov 08 '18 at 00:37
  • I am very happy to read that this solved your problem. In this case, please, upvote the question and / or mark it as the resolution. For the new question I suggest you to open a new question. I'd think that you can try pip install discord, for starters. – Pitto Nov 08 '18 at 11:41
  • this doesn't work for me...I get into a circular error: `(automl-meta-learning) [miranda9@golubh1 automl-proj]$ pip install -U pip Traceback (most recent call last): File "/home/miranda9/.local/bin/pip", line 5, in from pip._internal.cli.main import main ModuleNotFoundError: No module named 'pip._internal.cli.main'` – Charlie Parker Oct 20 '20 at 16:01
  • why does one need the `-m` flag in windows? – Charlie Parker Oct 20 '20 at 16:48
5

Try with "python -m pip install --upgrade pip --user" It worked with me and I am with Win10.

KAM
  • 69
  • 1
  • 6
  • 1
    Worked for me as well, thanks! OS specs: Edition >> Windows 10 Pro; Version >> 21H2; Installed on >> ‎3/‎12/‎2021; OS build >> 19044.1766; Experience >> Windows Feature Experience Pack 120.2212.4180.0. Python specs: 3.9.13. – David Espinosa Jun 27 '22 at 17:46
3

If you are on linux try this -

sudo su root

apt-get purge -y python-pip

wget https://bootstrap.pypa.io/get-pip.py

python ./get-pip.py

apt-get install python-pip

or

sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
eiram_mahera
  • 950
  • 9
  • 25
2

On OS X this worked for me

python -m pip install --upgrade pip
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Harry Moreno
  • 10,231
  • 7
  • 64
  • 116