-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Poetry self update fails on Windows with Access Denied, leaving poetry in a broken state #7610
Comments
Not sure if this helps, but I was upgrading from 1.2.2 to 1.4.0 today using this method and I encountered the same kind of OSError on Windows 10, albeit on a different file, amongst other issues with dependencies raising assertions. Note I ran |
Based on the logged commands it seems like the correct pip is executed. |
I'm guessing poetry uses the pip that comes with the python that was used to install it? In a nutshell, this issue was solved for me by reinstalling poetry in system powershell, with a system python (3.9.13 in my case), completely outside of anaconda, and double checking what the installer says about poetry path with what is in my actual PATH on windows. |
The recent update gave me this (different) error:
|
reinstalling works fine:
|
Honestly I have no idea how to proceed with this kind of issue :( It is reported regularly, but it is not reliable reproducible. The only thing the reports seems to have in common is, that this happens under Windows and a antivirus software is running. So if anyone has clue how to improve the situation ... |
I don't honestly understand how this is expected to work - isn't using poetry to manage its own environment all but certain sometimes to remove packages that poetry is actively using? A fairly regular error on this tracker is folk who have installed poetry in the project under management and then are surprised when adding and removing packages breaks that installation. I feel I must have missed something that makes it all fine, but isn't |
Good point, might be. But I saw this problem several times in normal project environments as well, when adding/updating/removing packages there. |
more or less by definition: not the same problem if it's not IMO if no-one can see a reason that |
after using This happened to me as well for the second time with different version. Since Poetry command is not working now(I have an idea what to do now but) have anyone thought of putting some errors into FAQ for ppl who are not that experienced with Poetry when this happens? Honestly this being first update experience with poetry, I'd leave for good. edit: I noticed I had a process running in the background with python under poetry. Might be connected with the issue. Even tho now I tried to have processes running while downgrading/upgrading but the issue didn't replicate. Might go tweak a little with the issue and report if anything happens. |
We should state WHY List of Issues
|
those issues are only superficially similar: all of them are related to a quite different problem (where python fails to clean up temporary directories on Windows, start at python/cpython#24793 if you want to dig into it). per an earlier comment: if it's not this issue is about: the poetry (python) process cannot update files while it is itself using them - or anyway, not without things going wrong. plainly pipx updating poetry's files is fine |
I'm still against removing |
But can there be a fix for the issue where poetry literally breaks itself when this exception is thrown? |
@iTitus I personally experience this error because when
[tool.poetry.scripts]
poetry = "poetry.console.application:main" to This is similar to the problem that happens when people use pip update pip and is why
works (or alternatively @dimbleby @finswimmer I believe this to be the culprit of the |
some but not all of the reports in this thread are about updating poetry.exe - #7610 (comment) is, the opener is not but in general: yes, this is what I have been saying throughout - the problem is poetry trying to update files while it is using them. |
Wholeheartedly agree; apologies if it took me a while to get there. This is also why using ‘pipx’ works, as you have rightly been pointing out. |
Out of curiosity, if one
also fix this? (Here |
|
FWIW, programs which update themselves (including the executable which performs the update) can work around Windows' restrictions by renaming the executable instead of deleting it. Windows complains if you delete an executable which is being run, but it does not complain if the executable is renamed (as long as it remains on the same drive, I think). The renamed file can be removed by the new executable the next time it is run, if desired. So, a way for |
none of the reported errors are about the poetry executable, the above is not relevant |
To be fair, this error was to do with And the issue with the Poetry executable is effectively the same cause as the issue with other permission errors reported here, I would argue it's still relevant. But you're right - the OSErrors are also arising from Poetry's dependencies being updated whilst Poetry is using them, especially DLLs ( Perhaps |
Apparently I knew that this was sometimes about poetry.exe at #7610 (comment)... But yes: it often isn‘t, so the renaming trick cannot be sufficient. While this brokenness mostly reveals itself on Windows I strongly suspect that it's there, ready to strike, everywhere. So I still favour deprecating the whole thing. (Another reason for wanting to lose |
Interesting, I understand why you want to remove
Deleting/replacing in-use files on *nix systems is generally fine - when a file like a shared library is deleted ( |
The recommended installation method is now |
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. |
-vvv
option) and have included the output below. (output included below, but not verbose)Issue
This has happened to me for multiple version updates in a row now.
Whenever upgrading poetry with
poetry self update
pip fails with an OSError and leaves Poetry in a broken state.A reinstall fixes that.
There are two problems here:
The text was updated successfully, but these errors were encountered: