Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self:update failed. Win10, Python 3.7.2 Dead poetry. #977

Closed
ST33LDI9ITAL opened this issue Mar 22, 2019 · 27 comments
Closed

self:update failed. Win10, Python 3.7.2 Dead poetry. #977

ST33LDI9ITAL opened this issue Mar 22, 2019 · 27 comments
Labels
kind/bug Something isn't working as expected

Comments

@ST33LDI9ITAL
Copy link

  • [ 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:\Python\WinPy\python-3.7.2.amd64>poetry show --version
Traceback (most recent call last):
File "C:\Users\ST33L.poetry\bin\poetry", line 11, in
from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

c:\Python\WinPy\python-3.7.2.amd64>poetry self:update --preview
Traceback (most recent call last):
File "C:\Users\ST33L.poetry\bin\poetry", line 11, in
from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

c:\Python\WinPy\python-3.7.2.amd64>curl -sSL https://github.com/raw/sdispater/poetry/master/get-poetry.py | py
Retrieving Poetry metadata

Latest version already installed.

@drunkwcodes
Copy link

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

What happened after re-downloading?

@ST33LDI9ITAL
Copy link
Author

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.

@drunkwcodes
Copy link

@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?

@ST33LDI9ITAL
Copy link
Author

Here ya go:

`C:\Python\poetry>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:\Users\ST33L.poetry\lib\poetry_vendor\py3.7\cleo\application.py in run() at line 94

C:\Users\ST33L.poetry\lib\poetry\console\application.py in do_run() at line 88

C:\Users\ST33L.poetry\lib\poetry_vendor\py3.7\cleo\application.py in do_run() at line 197

C:\Users\ST33L.poetry\lib\poetry\console\commands\command.py in run() at line 77

C:\Users\ST33L.poetry\lib\poetry_vendor\py3.7\cleo\commands\base_command.py in run() at line 146

C:\Users\ST33L.poetry\lib\poetry_vendor\py3.7\cleo\commands\command.py in execute() at line 107

C:\Users\ST33L.poetry\lib\poetry\console\commands\self\update.py in handle() at line 108

C:\Users\ST33L.poetry\lib\poetry\console\commands\self\update.py in update() at line 132

C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in rmtree() at line 513
return _rmtree_unsafe(path, onerror)
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 392
_rmtree_unsafe(fullname, onerror)
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 397
onerror(os.unlink, fullname, sys.exc_info())
C:\Python\WinPy\python-3.7.2.amd64\lib\shutil.py in _rmtree_unsafe() at line 395
os.unlink(fullname)

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

@drunkwcodes
Copy link

drunkwcodes commented Mar 22, 2019

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?

@ST33LDI9ITAL
Copy link
Author

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

@ST33LDI9ITAL
Copy link
Author

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

@dilzeem
Copy link

dilzeem commented Mar 28, 2019

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

@alex-lechner
Copy link

@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? 😩

@dilzeem
Copy link

dilzeem commented Jul 10, 2019

@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.

@KelSolaar
Copy link

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

@Sh4rK
Copy link

Sh4rK commented Oct 14, 2019

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.

@brycedrennan brycedrennan added the kind/bug Something isn't working as expected label Oct 15, 2019
@absassi
Copy link

absassi commented Jan 8, 2020

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.

@nicolaerario
Copy link

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

@jaepil-choi
Copy link

jaepil-choi commented Feb 29, 2020

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

Just copy paste Poetry installation commend, i.e:
$ curl -sSL https://github.com/raw/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)

@nicolaerario
Copy link

nicolaerario commented Feb 29, 2020

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

@jaepil-choi
Copy link

@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.

@nyanpasu64
Copy link

nyanpasu64 commented Mar 3, 2020

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://github.com/raw/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.

@jeriox
Copy link

jeriox commented Oct 13, 2020

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

@TBBle
Copy link
Contributor

TBBle commented Jan 4, 2021

Probably the only way Poetry can work around this is by renaming any .pyd file before it is replaced during the update, and not importing any more .pyd modules during the update. (I'm pretty sure you can rename an open .dll, just not delete it or overwrite it)

Then the renamed .pyd files need to be cleaned up later, by the new version of Poetry.

This is the same reason that on Windows, you python -m pip install --upgrade pip and not pip install --upgrade pip, because the latter locks the pip.exe, and you end up with no pip in your venv.

@CelestialStreamer
Copy link

If I open up PowerShell in administrator mode and run poetry self update I get the following error:

Traceback (most recent call last):
  File "C:\Users\woo12\.poetry\bin\poetry", line 17, in <module>
    from poetry.console import main
ModuleNotFoundError: No module named 'poetry.console'

PowerShell without administrator permissions goes on about those pyd files like you're all talking about.

@TBBle
Copy link
Contributor

TBBle commented Jun 12, 2021

Running as Administrator is a different issue, it's probably not able to set the path correctly for some reason. Did you install it as Administrator the first time?

@CelestialStreamer
Copy link

I don't remember how I installed it. I think it might have been with administrator privileges because I must be in administrator mode to run things like python -m pip install --upgrade pip. (upgrading pip)
In any case I am not able to upgrade poetry with or without administrator privileges. Due to different errors for each method.

@TBBle
Copy link
Contributor

TBBle commented Jun 18, 2021

Yeah, I suspect you will have to clean out Poetry entirely (delete C:\Users\woo12\.poetry), and reinstall not as administrator, to get it working correctly, as it sounds like part of your install is in Administrator, and part is as a regular user, and something's now conflicting.

I personally use pipx (which avoids a bunch of these issues) so I can't say for sure that there's not other things you'd need to delete. You virtual envs are probably stored in that directory too.

I haven't checked, but perhaps get-poetry.py has an "uninstall" option you can run as Administrator to clear out the existing install?

@Benzidrine
Copy link

I have given up on Poetry due to just experiencing this issue. Best hopes for the future of the project though but I did not find it had the reliability I would want from such a solution.

@finswimmer
Copy link
Member

The get-poetry.py script is deprecated. Please use the install-poetry.py script instead and the above mentioned issues should be solved.

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Jun 11, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests