question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`poetry self update --preview` leads to `[WinError 5] Access is denied: 'py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'`

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10 pro, version 1909
  • Poetry version: 1.0.9
  • Link of a Gist with the contents of your pyproject.toml file: no project specific probelm

Issue

I use powershell and pyenv on windows with python 3.7. Python 3.7.5 is the newest version according to pyenv install -l Updating to the latest preview does not work as expected, I assumed poetry self update --preview would work. But see the log below, I can reproduce it every time with the same error. Installing/using poetry 1.0.9 works without issues. I guess it is similar to #1032 as shutil.py is involved in both problems, but the error is different.

Steps to reproduce

  1. install poetry with (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
  2. try to update with poetry self update --preview

Afterwards the poetry installation is corrupted and does not work anymore

Workaround powershell command

  1. delete the .poetry folder manually (located in user home directory)
  2. (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --preview

Log that shows error

PS C:\Users\jahna> (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

%USERPROFILE%\.poetry\bin

This path will then be added to your `PATH` environment variable by
modifying the `HKEY_CURRENT_USER/Environment/PATH` registry key.

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing version: 1.0.9
  - Downloading poetry-1.0.9-win32.tar.gz (10.72MB)

Poetry (1.0.9) is installed now. Great!

To get started you need Poetry's bin directory (%USERPROFILE%\.poetry\bin) in your `PATH`
environment variable. Future applications will automatically have the
correct environment, but you may need to restart your current shell.

PS C:\Users\jahna> poetry self update --preview -vvv
Updating to 1.1.0a3

[PermissionError]
[WinError 5] Access is denied: 'C:\\Users\\jahna\\.poetry\\lib\\poetry\\_vendor\\py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'

Traceback (most recent call last):
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\console_application.py", line 131, in run
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py", line 120, in handle
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\api\command\command.py", line 171, in _do_handle
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\command.py", line 92, in wrap_handle
  File "C:\Users\jahna\.poetry\lib\poetry\console\commands\self\update.py", line 134, in handle
  File "C:\Users\jahna\.poetry\lib\poetry\console\commands\self\update.py", line 146, in update
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 516, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 395, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  [Previous line repeated 1 more time]
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 400, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jahna\.pyenv\pyenv-win\versions\3.7.5-amd64\lib\shutil.py", line 398, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jahna\\.poetry\\lib\\poetry\\_vendor\\py3.7\\msgpack\\_cmsgpack.cp37-win_amd64.pyd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jahna\.poetry\bin\poetry", line 18, in <module>
    main()
  File "C:\Users\jahna\.poetry\lib\poetry\console\__init__.py", line 5, in main
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\console_application.py", line 139, in run
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 58, in render
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 63, in _render_traceback
  File "C:\Users\jahna\.poetry\lib\poetry\_vendor\py3.7\clikit\ui\components\exception_trace.py", line 75, in _format_traceback_frame
TypeError: 'NoneType' object is not subscriptable

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:16
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
mrtolkiencommented, Aug 20, 2021

Still having the same issue in 2021, had to uninstall and use the new install script to get the preview working:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python - --preview

Not finding any definitive solution online and I followed the exact install steps, not sure how to fix it without a full re-install.

4reactions
myliyifeicommented, Jul 26, 2020

I’m having the same problem, even with the latest 1.1.0B2 version, I tested powershell, cmd and elevated cmd with the same error.

Updating to 1.1.0b1 Traceback (most recent call last): File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\console_application.py”, line 131, in run File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\api\command\command.py”, line 120, in handle File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\api\command\command.py”, line 171, in _do_handle File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\cleo\commands\command.py”, line 92, in wrap_handle File “C:\Users\yifeili.poetry\lib\poetry\console\commands\self\update.py”, line 128, in handle File “C:\Users\yifeili.poetry\lib\poetry\console\commands\self\update.py”, line 140, in update File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 737, in rmtree return _rmtree_unsafe(path, onerror) File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 610, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 610, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 610, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) [Previous line repeated 1 more time] File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 615, in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) File “C:\Users\yifeili\AppData\Local\Programs\Python\Python38\lib\shutil.py”, line 613, in _rmtree_unsafe os.unlink(fullname) PermissionError: [WinError 5] Access is denied: ‘C:\Users\yifeili\.poetry\lib\poetry\_vendor\py3.8\msgpack\_cmsgpack.cp38-win_amd64.pyd’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “C:\Users\yifeili.poetry\bin\poetry”, line 18, in <module> main() File “C:\Users\yifeili.poetry\lib\poetry\console_init_.py”, line 5, in main File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\console_application.py”, line 142, in run File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\ui\components\exception_trace.py”, line 232, in render File “C:\Users\yifeili.poetry\lib\poetry_vendor\py3.8\clikit\ui\components\exception_trace.py”, line 251, in _render_exception ModuleNotFoundError: No module named ‘crashtest.inspector’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not install packages due to an EnvironmentError ...
When I run pip install pip --upgrade pip in a CMD with administrator rights in order to install in a virtualenv, I get...
Read more >
Introduction | Documentation | Poetry - Python dependency ...
Introduction Poetry is a tool for dependency management and packaging in Python. ... your project depends on and it will manage (install/update) them...
Read more >
OSError: [WinError 5] Access is denied when upgrading from
I am trying to upgrade from QATrack+ v0.2.9 to v3.1.0 on Windows server ... ERROR: Could not install packages due to an OSError:...
Read more >
Poetry update has access denied - Anycodings.com
Poetry update has access denied I'm using poetry inside a conda environmentm ... due to an EnvironmentError: [WinError 5] Access is denied:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found