-1

I am trying to install python libraries using pip. I used the command:

    pip install matplotlib

this is what I got

then I used

    python -m pip install --upgrade pip'

I also used this code I found on a website:

import os
import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 300, height = 350, bg = 'lightsteelblue2', relief = 'raised')
canvas1.pack()

label1 = tk.Label(root, text='Upgrade PIP', bg = 'lightsteelblue2')
label1.config(font=('helvetica', 20))
canvas1.create_window(150, 80, window=label1)

def upgradePIP ():
    os.system('start cmd /k python.exe -m pip install --upgrade pip') 

button1 = tk.Button(text='      Upgrade PIP     ', command=upgradePIP, bg='green', fg='white', font=('helvetica', 12, 'bold'))
canvas1.create_window(150, 180, window=button1)

root.mainloop()

the output of the code.as per instruction you got to click on the upgrade button and it will take you to cmd prompt

this command was instructed to use

    python -m pip install pip==20.1

in both ways I received the same error error while upgrading

so no matter what I'm doing I'm receiving the same error.

  • Did you run your terminal as an administrator? Seams like a permission error. (You can install as a user, but you need to add `--user` to your command) – Torxed May 04 '20 at 11:29
  • https://stackoverflow.com/search?q=%5Bpip%5D+OSError+13+Permission+denied – phd May 04 '20 at 14:05

2 Answers2

0

Do the PIP install in an administrative command prompt. It seems your command prompt does not have required priviledges.

Just press win key and type cmd, and select the command prompt and right click on it

From the menu, select Run as Administrator

How to do administrator command prompt

Tharaka Devinda
  • 1,952
  • 21
  • 23
0

The main issue is that you're trying to install packages in a destination that your user don't have permission to do. This is why you're getting:

"Permission denied: 'c:\\program files (x86)\\"

There's two workarounds, Tharaka Devinda put it nicely. You can run the command prompt as administrator. This will give you permissions enough to install in the destination.

The other solution, is to do add --user to pip, this will install the libraries in your user directory (and not for all other users). For instance:

pip install --user matplotlib

Which whould do the trick. Upgrading pip however might (most likely) require administrator privileges non the less, but this is useful for when you're on a borrowed computer and can't install stuff as administrator : )

Torxed
  • 22,866
  • 14
  • 82
  • 131
  • I tried --user earlier, it didn't work. Sorry forgot to mention it in the question. – Tusharika Joshi May 04 '20 at 12:22
  • Ah, you commented `Thanks! I tried just now and it worked.` so I assumed that fixed the issue hehe. I'll leave the answer here for anyone having issues installing packages as user : ) – Torxed May 04 '20 at 12:44
  • No the administrator thing worked. --user didn't. – Tusharika Joshi May 04 '20 at 12:58
  • @TusharikaJoshi I understand. Don't forget to mark Tharaka Devinda's answer as the correct one and best of luck to your project :) – Torxed May 04 '20 at 13:12