poetry: poetry.exe breaks after self upgrade on Windows
- I am on the latest Poetry version (sort of).
- 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).
- Windows 10:
- 1.1.13 upgraded to 1.12.0b1:
Issue
When upgrading poetry using poetry self update --preview
, poetry is no longer operable.
Log from a fresh poetry 1.1.13 install:
> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --uninstall
Poetry is not currently installed.
> poetry
Fatal error in launcher: Unable to create process using '"...\AppData\Roaming\pypoetry\venv\Scripts\python.ex
> (Invoke-WebRequest -Uri https://install.python-poetry.org -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:
...\AppData\Roaming\Python\Scripts
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.1.13)
Installing Poetry (1.1.13): Creating environment
Installing Poetry (1.1.13): Installing Poetry
Installing Poetry (1.1.13): Creating script
Installing Poetry (1.1.13): Done
Poetry (1.1.13) is installed now. Great!
`poetry --version`
> poetry --version
Poetry version 1.1.13
> poetry self --help
USAGE
poetry self
or: poetry self update [--preview] [<version>]
COMMANDS
update
Updates Poetry to the latest version.
<version> The version to update to.
--preview Install prereleases.
GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and
"-vvv" for debug
-V (--version) Display this application version
-n (--no-interaction) Do not ask any interactive question
> poetry self update --preview
Updating Poetry to 1.2.0b1
Updating dependencies
Resolving dependencies...
Package operations: 1 install, 3 updates, 0 removals
- Updating cleo (0.8.1 -> 1.0.0a4)
- Installing entrypoints (0.3)
- Updating poetry-core (1.0.8 -> 1.1.0a7)
- Updating poetry (1.1.13 -> 1.2.0b1)
Updating the poetry script
Poetry (1.2.0b1) is installed now. Great!
> poetry --version
Traceback (most recent call last):
File "...\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "...\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "...\AppData\Roaming\Python\Scripts\poetry.exe\__main__.py", line 4, in <module>
ImportError: cannot import name 'main' from 'poetry.console' (...\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\__init__.py)
> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --uninstall
Removing Poetry (1.1.13)
I needed to update to 1.2.0b1
due to the bug where I could not install CUDA versions of TorchVision and PyTorch together, but this unfortunately seems to have completely bricked my poetry install, requiring a manual deletion of remaining files.
A fully fresh install with (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --version 1.2.0b1
does seem to work, however.
> (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - --version 1.2.0b1
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:
...\AppData\Roaming\Python\Scripts
You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.
Installing Poetry (1.2.0b1)
Installing Poetry (1.2.0b1): Creating environment
Installing Poetry (1.2.0b1): Installing Poetry
Installing Poetry (1.2.0b1): Creating script
Installing Poetry (1.2.0b1): Done
Poetry (1.2.0b1) is installed now. Great!
You can test that everything is set up by executing:
`poetry --version`
> poetry --version
Poetry (version 1.2.0b1)
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 18 (2 by maintainers)
I’m on Windows 11 running Python 3.8 installed from python.org with
py.exe
supportpoetry.exe
from path$env:APPDATA\Python\Scripts
has no updated timestamp$env:APPDATA\pypoetry\poetry.exe
$env:APPDATA\pypoetry\venv\Lib\site-packages\poetry
As it is hard on Windows to compare who installed which Python (Microsoft Store vs python.org) your mileage (folder locations) may vary.
exe
to theScript
folder is all what is missing on Windows?This is an issue in the
1.2.0
version also. Just ranpoetry self update
and now get this error:Given the tip from spex I wonder if we’re writing
poetry.exe
to the wrong spot duringself upgrade
on Windows – I cannot get this to reproduce myself, though I am yet to try a Windows container.I also wonder if this might be some Windows file locking issues popping up again – self-upgrading Windows software is always a bit of a song and dance.
I can confirm the process for manually fixing this works as mentioned by spex66