Search code examples
pythonpython-3.xwindowspython-poetry

ERROR: ".Content was unexpected at this time." while installing poetry


I am trying to install poetry in my windows system.
The command that I am using is (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - From official docs here.
However, I`m getting the following error.
Earlier I used the same command it worked fine but somehow its not working this time.

Error:

C:\Project_Files\project>(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
.Content was unexpected at this time.

If anyone from the community could support would be very helpful for me.


Solution

  • I switched the terminal from cmd to powershell.
    This solved the issue for me.

    Using cmd: enter image description here Using powershell: enter image description here

    In the docs its mentioned we should use powershell to run the installation command.

    **USEFULL INFORMATION:**
    I tired it works fine with cmd as well you just have to open cmd with admin rights.
    

    enter image description here

    Also try the following if that doesn`t work for you :-

    Firstly make sure you have python installed in your system.
    Command to check python: 1)python --version 2)python.exe - this should open the interactive console.

    And as mentioned on the docs.
    If you have installed Python through the Microsoft Store, replace py with python in the command above.

    Also please refer to this github issue, there are multiple solutions provided.