Poetry: self:update failed. Win10, Python 3.7.2 Dead poetry.

Created on 22 Mar 2019  路  19Comments  路  Source: python-poetry/poetry

  • [ x] I am on the latest Poetry version.
  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name:
  • Poetry version:
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Went to self:update from 0.12.11 to 1.0.0.a2 preview and got this.

c:PythonWinPypython-3.7.2.amd64>poetry show --version
Traceback (most recent call last):
File "C:UsersST33L.poetrybinpoetry", line 11, in
from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

c:PythonWinPypython-3.7.2.amd64>poetry self:update --preview
Traceback (most recent call last):
File "C:UsersST33L.poetrybinpoetry", line 11, in
from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

c:PythonWinPypython-3.7.2.amd64>curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | py
Retrieving Poetry metadata

Latest version already installed.

Bug Triage

Most helpful comment

Here ya go:

`C:Pythonpoetry>poetry self:update --preview -vvv
Updating to 1.0.0a2

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

Exception trace:
C:UsersST33L.poetrylibpoetry_vendorpy3.7cleoapplication.py in run() at line 94

C:UsersST33L.poetrylibpoetryconsoleapplication.py in do_run() at line 88

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleoapplication.py in do_run() at line 197

C:UsersST33L.poetrylibpoetryconsolecommandscommand.py in run() at line 77

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleocommandsbase_command.py in run() at line 146

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleocommandscommand.py in execute() at line 107

C:UsersST33L.poetrylibpoetryconsolecommandsselfupdate.py in handle() at line 108

C:UsersST33L.poetrylibpoetryconsolecommandsselfupdate.py in update() at line 132

C:PythonWinPypython-3.7.2.amd64libshutil.py in rmtree() at line 513
return _rmtree_unsafe(path, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 397
onerror(os.unlink, fullname, sys.exc_info())
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 395
os.unlink(fullname)

self:update [--preview] [--] []`

All 19 comments

The error msg of updating is missing.
How to reproduce it?

What happened after re-downloading?

Ok, so I'm on Win10, and have multiple versions of Python, and I do things the windows way. Which is by using py launcher. So, in order for poetry to run I change poetry.bat python command to py. When updating it redownload then ofcourse it wouldn't run because of the bat changed back to python instead of py. So, I changed it back to py then reran and error still persisted. After deleting poetry folders, setting path to python, it then installed cleanly.

Basically, doesn't support py launcher.

@ST33LDI9ITAL Let me clarify that: you solved it by cleaning up manually and fixing the executable path.

The history in your cmd is worth of reserving before figuring the issue out.

I'm still wondering the debug msg of self:update command. Will you share it anyway?

Here ya go:

`C:Pythonpoetry>poetry self:update --preview -vvv
Updating to 1.0.0a2

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

Exception trace:
C:UsersST33L.poetrylibpoetry_vendorpy3.7cleoapplication.py in run() at line 94

C:UsersST33L.poetrylibpoetryconsoleapplication.py in do_run() at line 88

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleoapplication.py in do_run() at line 197

C:UsersST33L.poetrylibpoetryconsolecommandscommand.py in run() at line 77

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleocommandsbase_command.py in run() at line 146

C:UsersST33L.poetrylibpoetry_vendorpy3.7cleocommandscommand.py in execute() at line 107

C:UsersST33L.poetrylibpoetryconsolecommandsselfupdate.py in handle() at line 108

C:UsersST33L.poetrylibpoetryconsolecommandsselfupdate.py in update() at line 132

C:PythonWinPypython-3.7.2.amd64libshutil.py in rmtree() at line 513
return _rmtree_unsafe(path, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 397
onerror(os.unlink, fullname, sys.exc_info())
C:PythonWinPypython-3.7.2.amd64libshutil.py in _rmtree_unsafe() at line 395
os.unlink(fullname)

self:update [--preview] [--] []`

Is it a file permission problem?

And you ran the installer as the administrator?

What if you re-install the Python on another disk different from C:, do not install as administrator at first.

Correct: Modify the checkboxes in py launcher.
Do not install for all users and add it (will be a python executables in AppData) to PATH.

Then also try to install poetry as user making them having the same owner?

Appears so, but only with itself, the update process. Ran under Administrator cmd. Can delete folder with no locking issues.

As for the rest of that.. that鈥檚 not how I set up python and not about to change. It鈥檚 my belief that if you are designing an external supplement for it that you should cover all bases. I鈥檓 simply reporting the issue.

Also getting exactly the same issue using windows 10.

I managed to solve by deleting the offending file:

'C:\%USERPROFILE%\.poetry\lib\poetry\_vendor\py3.7\msgpack\_cmsgpack.cp37-win_amd64.pyd'

I then ran
poetry self:update --preview

@dilzeem if I do the steps like you did (1. Deleteing the _cmsgpack.cp37-win_amd64.pyd and 2. execute poetry self:update --preview afterwards) I get the following error:

Updating to 1.0.0a3

[OSError]
[WinError 145] The directory is not empty: 'C:\\Users\\Alexa\\.poetry\\l
ib\\poetry\\_vendor'

self:update [--preview] [--] [<version>]

Why does installing stuff for Python on Windows has to be such a burden every single time? 馃槱

@alex-lechner

I ran into this same issue again, and I was able to figure it out. You need to close the windows explorer window after you have deleted the _cmsgpack.cp37-win_amd64.pyd.

Just had the same problem on Github Actions: https://github.com/KelSolaar/colour/runs/238653725#step:5:52

I ran into the same problem today.

C:\redacted>poetry --version
Poetry 0.12.17


C:\redacted>poetry self:update --preview
Updating to 1.0.0b2

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

self:update [--preview] [--] [<version>]


C:\redacted>poetry self:update --preview
Traceback (most recent call last):
  File "C:\Users\redacted\.poetry\bin\poetry", line 12, in <module>
    from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

I suspect the problem is that Windows locks currently executing files and loaded DLLs (and pyd files are DLLs), so replacing or deleting this file fails (though from the error message it's not clear what file operation is taking place).

But, I haven't looked at the code, I may be totally wrong.

I also have the same problem, and the best solution I found for me is to use pipx instead to manage Poetry installation on Windows, as suggested in the docs. It works like a charm, doesn't install its dependencies globally as it would be using pip and upgrading Poetry is as easy as pipx upgrade poetry, no locking issues.

I can confirm: it appens on every poetry self update ; locked files interrupt the upgrade. I had to reinstall from scratch. Tried both with ps and ps with admin rights

Here's my solution, which I believe is THE EASIEST.

Just copy paste Poetry installation commend, i.e:
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

on your os/linux/bashonwindows terminal, and wait.

Done.

I'm on:
Windows 10 Pro 64bit
Python 3.7.6 64bit
Poetry 1.0.2 --> 1.0.4 (the latest)

Sorry @jaepil-choi but I can call your solution "re-install it on top"...
I don't think it can be called solution, maybe workaround.

However, the problem persist on windows (10) and also with new poetry self update command; the python version is irrilevant. @ST33LDI9ITAL Wouldn't it be better to adjust the issue title accordingly?
EDIT: forgot to mention op in the last sentence

@nicolaerario Yeah, a workaround is a correct term I guess. It does remedy the problem though, because the worst thing that happens when you initially fail update with poetry self update, is that poetry command just stops working. For those people, this workaround can help.

Still, I hope this gets fixed in later releases.
As for issue title, it's not the issue I raised so OP, @ST33LDI9ITAL, should rename the title.

I experienced this error upgrading from 1.0.3 to 1.0.5 (latest) via self upgrade. Reinstalling 1.0.5 via curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python, then running poetry self upgrade 1.0.3, produced the same error message on _cmsgpack.cp37-win_amd64.pyd.

I think I'll try pipx instead of get-poetry.

EDIT: pipx install poetry works flawlessly, so far.

just ran into the same issue. Any news on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jbarlow83 picture jbarlow83  路  3Comments

thmo picture thmo  路  3Comments

thejohnfreeman picture thejohnfreeman  路  3Comments

nikaro picture nikaro  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments