Как установить poetry 1.2.2 в Windows (WSL)?

У меня была установлена Poetry version 1.1.13 через команду sudo apt install python3-poetry сейчас хочу установить Poetry version 1.2.2 в Windows (WSL). Для начала удаляю poetry командой sudo apt remove python3-poetry и затем пробую установить Poetry командой curl -sSL https://install.python-poetry.org | python3 - и ничего не получается, вот что выдает терминал:

Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/home/em0ji/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.2): Restoring previously saved environment.
Traceback (most recent call last):
  File "<stdin>", line 940, in <module>
  File "<stdin>", line 919, in main
  File "<stdin>", line 550, in run
  File "<stdin>", line 571, in install
  File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "<stdin>", line 643, in make_env
  File "<stdin>", line 629, in make_env
  File "<stdin>", line 344, in make
  File "<stdin>", line 367, in pip
  File "<stdin>", line 364, in python
  File "<stdin>", line 350, in run
  File "/usr/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1847, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/em0ji/.local/share/pypoetry/venv/bin/python'

Как решить проблему установки?


Ответы (1 шт):

Автор решения: em0ji

Debian/Ubuntu

В системах Debian и Ubuntu существуют различные проблемы, которые могут быть вызваны тем, как упакованы и настроены различные компоненты стандартной библиотеки Python.

Примечание: Это также может повлиять на пользователей WSL в Windows.

Схема установки:

Обойти эту проблему можно установив для переменной окружения DEB_PYTHON_INSTALL_LAYOUT значение deb, чтобы эмулировать ранее работавшее поведение.

export DEB_PYTHON_INSTALL_LAYOUT=deb

Далее просто производим установку Poetry:

curl -sSL https://install.python-poetry.org | python3 -

Вывод терминала:

Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/home/em0ji/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.2): Done

Poetry (1.2.2) is installed now. Great!

You can test that everything is set up by executing:

`poetry --version`

Проблема решена.

→ Ссылка