简体   繁体   中英

Poetry installation with Windows WSL not working, ignoring $HOME

I have a WSL instance, Ubuntu 20.04 and I have created another Ubuntu 18.04 WSL instance.

I installed Poetry on the 20.04 without issues.

I am trying to install Poetry on the Ubuntu 18.04 instance, using the curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - command.

At the moment, my $HOME env var points to /home/fromzeroedu .

However, after installation, Poetry is installed on my Windows user home:

$ which poetry
/mnt/c/Users/j/.poetry/bin/poetry

And if I try getting the version, I get:

$ poetry --version
/usr/bin/env: ‘python\r’: Permission denied

I even tried setting the POETRY_HOME prior to installation:

export POETRY_HOME=/home/fromzeroedu/.poetry/bin/poetry

But Poetry still installs in the Windows user directory.

Sometimes I love Poetry...

After much debugging, and for people looking for the answer, this is what I recommend doing:

  • If you are seeing this issue, uninstall and reinstall WSL.
  • Uninstall Poetry from your Windows side raising a Powershell in admin mode and doing (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --uninstall (Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --uninstall if you installed using the get-poetry route. Otherwise do pip uninstall poetry .
  • Install WSL and then make sure Poetry is no longer installed by typing poetry
  • Also check on the Windows side that Poetry is not installed by typing poetry
  • On Windows install Poetry using pip: pip install poetry . Check that it works by typing poetry .
  • On WSL install using the get-poetry route. For example, on Ubuntu, do curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - . Check Poetry is installed by typing: poetry .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM