Python 3.5.0b2 - permission error after pip upgrade

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Python 3.5.0b2 - permission error after pip upgrade

Andreas Balogh
I've installed a fresh copy of Python 3.5.0b2 and - as recommended - upgraded pip. I don't
understand the reason for the permission errors as I am owner and have full control for
the temporary directory created.

What can I do to fix this?


C:\Apps\Python35>pip install --upgrade pip
You are using pip version 7.0.1, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
  Downloading pip-7.0.3-py2.py3-none-any.whl (1.1MB)
    100% |################################| 1.1MB 422kB/s
Installing collected packages: pip
  Found existing installation: pip 7.0.1
    Uninstalling pip-7.0.1:
      Successfully uninstalled pip-7.0.1
Exception:
Traceback (most recent call last):
  File "C:\Apps\Python35\lib\shutil.py", line 377, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied:
'C:\\Users\\Andreas\\AppData\\Local\\Temp\\pip-xf9kwi7g-uninstall\\apps\\python35\\scripts\\pip.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Apps\Python35\lib\site-packages\pip\basecommand.py", line 223, in main
    status = self.run(options, args)
  File "C:\Apps\Python35\lib\site-packages\pip\commands\install.py", line 297, in run
    root=options.root_path,
  File "C:\Apps\Python35\lib\site-packages\pip\req\req_set.py", line 633, in install
    requirement.commit_uninstall()
  File "C:\Apps\Python35\lib\site-packages\pip\req\req_install.py", line 734, in
commit_uninstall
    self.uninstalled.commit()
  File "C:\Apps\Python35\lib\site-packages\pip\req\req_uninstall.py", line 153, in commit
    rmtree(self.save_dir)
  File "C:\Apps\Python35\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "C:\Apps\Python35\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "C:\Apps\Python35\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "C:\Apps\Python35\lib\site-packages\pip\_vendor\six.py", line 659, in reraise
    raise value
  File "C:\Apps\Python35\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "C:\Apps\Python35\lib\site-packages\pip\utils\__init__.py", line 89, in rmtree
    onerror=rmtree_errorhandler)
  File "C:\Apps\Python35\lib\shutil.py", line 484, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Apps\Python35\lib\shutil.py", line 374, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Apps\Python35\lib\shutil.py", line 374, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Apps\Python35\lib\shutil.py", line 374, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Apps\Python35\lib\shutil.py", line 379, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Apps\Python35\lib\site-packages\pip\utils\__init__.py", line 101, in
rmtree_errorhandler
    func(path)
PermissionError: [WinError 5] Access is denied:
'C:\\Users\\Andreas\\AppData\\Local\\Temp\\pip-xf9kwi7g-uninstall\\apps\\python35\\scripts\\pip.exe'


--
baloand (at) gmail.com

Reply | Threaded
Open this post in threaded view
|

Python 3.5.0b2 - permission error after pip upgrade

Chris Angelico
On Fri, Jun 12, 2015 at 4:57 AM, Andreas Balogh <baloand at gmail.com> wrote:

> I've installed a fresh copy of Python 3.5.0b2 and - as recommended - upgraded pip. I don't
> understand the reason for the permission errors as I am owner and have full control for
> the temporary directory created.
>
> What can I do to fix this?
>
>
> C:\Apps\Python35>pip install --upgrade pip
>   File "C:\Apps\Python35\lib\shutil.py", line 377, in _rmtree_unsafe
>     os.unlink(fullname)
> PermissionError: [WinError 5] Access is denied:
> 'C:\\Users\\Andreas\\AppData\\Local\\Temp\\pip-xf9kwi7g-uninstall\\apps\\python35\\scripts\\pip.exe'

This is a problem with the way Windows locks running executables,
conflicting with the way pip wants to delete (unlink) the executable.
It appears to be a known issue by the pip people:

https://github.com/pypa/pip/issues/2773

One workaround is to skip the short-hand "pip" when upgrading pip
itself, and type out the command in full:

python -m pip install --upgrade pip

Just make sure you run the same Python (so you may need to run
"python3 -m pip etc", not sure) so it upgrades the right pip.

ChrisA

Reply | Threaded
Open this post in threaded view
|

Python 3.5.0b2 - permission error after pip upgrade

Zachary Ware-2
On Thu, Jun 11, 2015 at 2:15 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Jun 12, 2015 at 4:57 AM, Andreas Balogh <baloand at gmail.com> wrote:
>> I've installed a fresh copy of Python 3.5.0b2 and - as recommended - upgraded pip. I don't
>> understand the reason for the permission errors as I am owner and have full control for
>> the temporary directory created.
>>
>> What can I do to fix this?
>>
>>
>> C:\Apps\Python35>pip install --upgrade pip
>>   File "C:\Apps\Python35\lib\shutil.py", line 377, in _rmtree_unsafe
>>     os.unlink(fullname)
>> PermissionError: [WinError 5] Access is denied:
>> 'C:\\Users\\Andreas\\AppData\\Local\\Temp\\pip-xf9kwi7g-uninstall\\apps\\python35\\scripts\\pip.exe'
>
> This is a problem with the way Windows locks running executables,
> conflicting with the way pip wants to delete (unlink) the executable.
> It appears to be a known issue by the pip people:
>
> https://github.com/pypa/pip/issues/2773
>
> One workaround is to skip the short-hand "pip" when upgrading pip
> itself, and type out the command in full:
>
> python -m pip install --upgrade pip
>
> Just make sure you run the same Python (so you may need to run
> "python3 -m pip etc", not sure) so it upgrades the right pip.

More accurately for Windows, you'll probably want 'py -3.5 -m pip ...'.

--
Zach