Skip to content

Troubleshooting Windows usage #3598

@papb

Description

@papb
  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

Hello! I and a colleague spent a lot of time debugging why poetry wasn't working properly in our Windows. Some examples of weird outputs that we were getting:

  • The following sequence sometimes gives "No dependencies to install or update":
    • mkdir temp && cd temp
    • poetry init (accepting all defaults)
    • poetry add pyyaml
  • poetry run python sometimes hangs
  • poetry shell, poetry install and poetry add pyyaml (or any package) almost always gave a warning that the "environment seems to be broken"

We finally worked out a solution, I think it would be worth having a section on the documentation describing this. I've written the steps below.

How to fix glitchy poetry on Windows

  • Just in case, close PyCharm if you have it running (not sure if this was really necessary)

  • Uninstall poetry:

    • mkdir temp && cd temp
    • curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > get-poetry.py
    • python get-poetry.py --uninstall
    • rm get-poetry.py
    • cd .. && rmdir temp
  • Delete the pypoetry folder in C:\Users\your_windows_user\AppData\Local

  • From now on, use only Git Bash, and without the -i option.

    • DON'T use Windows cmd
    • DON'T use "Open Git Bash Here" from the Windows context menu (since it starts bash.exe with the -i option)
    • DO use C:\Program Files\Git\bash.exe
    • DO use Git Bash from VSCode, which works too:
      • "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
  • Install poetry:

    • Open C:\Program Files\Git\bash.exe
    • curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
    • Close the terminal

It should work now when you use Git Bash (directly or from within VSCode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docsDocumentation issues/improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions