8

Running command prompt as an administrator I try to run:

easy_install -U setuptools

It returns the following:

Searching for setuptools
Reading https://pypi.python.org/simple/setuptools/
Reading http://peak.telecommunity.com/snapshots/
Reading https://pypi.python.org/pypi/setuptools
Best match: setuptools 0.8
Processing setuptools-0.8-py2.7.egg
setuptools 0.8 is already the active version in easy-install.pth
Installing easy_install-script.py script to C:\Python27\Scripts
Installing easy_install.exe script to C:\Python27\Scripts
error: C:\Python27\Scripts\easy_install.exe: Permission denied

I've spent the past few hours scouring the internet for possible solutions. I've tried messing with the UAC settings and have them set to Never Notify. Yet, I'm still getting this permission denied error.

CKav
  • 81
  • 1
  • 2

2 Answers2

12

You can read the solution here.

Run the install.
After the error copy the easy_install .exe and .py to a temp dir (i.e. c:\temp).
Run the install again from there.

On windows, the easy_install binary is in-use during install so it can't overwrite itself. (Easy_install itself is part of the setuptools you're trying to install with itself ;)

HyphenSam
  • 35
  • 1
  • 2
  • 8
Rik
  • 1,982
  • 1
  • 17
  • 30
  • This is not working for me. When installing from the temp folder, the process is still trying to access easy_install in the anaconda3 path. When you say "install from there", could you elaborate a bit on how you install from the temp folder? Thanks! @MarcusJohansson – BossaNova Jun 04 '19 at 07:44
  • @BossaNova The fact easy_install.exe binary in the anaconda path is accessed isn't a problem because you started the c:\temp\easy_install.exe so the one in the path isn't in use anymore (and can be accessed and overwritten without problems). Do note that at the moment easy_install is deprecated. Doesn't `pip install setuptools` work for you? – Rik Jun 04 '19 at 11:28
  • @Rik Thanks for the answer. I got the same permission error as before since, as you say, the same file is accessed. But I probably did not understand what it means to "install from there". Anyway, I could make it work somehow so for the moment it is fine. – BossaNova Jun 16 '19 at 08:04
8

Another way would be to use the other python package manager: Pip.

easy_install pip    
pip install --upgrade setuptools

This gets around the "in-use" problem without having to move files around.

hazzey
  • 1,179
  • 25
  • 29
  • It seemed to take a combination of both for me to reinstall an old version on Windows 10 when the existing install couldn't overwrite itself and couldn't find it's own egg. C:\Python27\python -m pip install -U setuptools==3.3 -U --proxy http://user:pass@proxy:port – Seth Oct 19 '18 at 14:53