Thursday, October 27, 2022

[SOLVED] Creating new poetry environment broken (ImportError: cannot import name 'main' from 'poetry.console')

Issue

I want to create a new poetry environment for my poetry project because I deleted the one I had: src="https://i.stack.imgur.com/RGCP7.png" alt="enter image description here" />

But I have the following error: enter image description here

Here is the command output:

Traceback (most recent call last):
  File "C:\Users\lhott\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\lhott\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\lhott\AppData\Roaming\Python\Scripts\poetry.exe\__main__.py", line 4, in <module>
ImportError: cannot import name 'main' from 'poetry.console' (C:\Users\lhott\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\__init__.py)

Solution

Uninstalling poetry and re-installing it with:

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

solved the problem.



Answered By - FluidMechanics Potential Flows
Answer Checked By - David Marino (WPSolving Volunteer)