-1

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.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30

1 Answers1

1

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.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30
  • The documentation **tells you** that this version of the command is for Powershell, and it should also be obvious to anyone with a passing familiarity with either Powershell or `cmd`. Voting to close as a typo. – Karl Knechtel Oct 07 '22 at 05:57
  • Thanks @KarlKnechtel for mentioning this. But according to me, we should have this on the platform. Bcz somehow I missed that, someone else could miss it too & if anyone encounters the same error msg they would find the solution easily. Rather then googling it here and there & wasting time to do hit and trial. Perhaps lets wait for other reviewers and if multiple people gives down vote I`ll remove this. – Lakshay Rohilla Oct 07 '22 at 12:22
  • @KarlKnechtel, just for your knowledge. We can install poetry using cmd as well, but we have to open cmd with admin rights. – Lakshay Rohilla Oct 10 '22 at 11:18
  • I'm aware, because I installed it using `cmd` back when I used Windows. Didn't need admin rights (for per-user installs), either. However, the Powershell instructions on the website are Powershell specific. This question isn't a question about how to write code; it's about how to understand the UI *on the python-poetry.org website*, which is why I voted to close. – Karl Knechtel Oct 10 '22 at 17:50