python-poetry / python-poetry/poetry

findpython fails with pyenv shim (exit 127) on Poetry 2.x – “Command .../pyenv/shims/python … returned non‑zero exit status 127”

Open
#10,343 2 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

Description
Environment
  • OS Ubuntu 22.04

  • Poetry 2.1.2 (installed via pipx install --suffix "@2.1.2" --python ~/.pyenv/versions/3.12.7/bin/python poetry==2.1.2)

  • Python used by pyenv 3.12.7 (pyenv install 3.12.7)

  • pyenv 2.4.0

Steps to Reproduce

1. install Poetry 2 inside a pipx venv with the same interpreter
pipx install --suffix "@2.1.2" --python ~/.pyenv/versions/3.12.7/bin/python poetry==2.1.2

2. run poetry init (interactive or --no-interaction)
/home/<user>/.local/pipx/venvs/poetry@2-1-2/bin/poetry init

After answering the interactive prompts Poetry aborts with:
Command '['/home//.pyenv/shims/python', '-EsSc', 'import sys; print(sys.executable)']' returned non-zero exit status 127.

Poetry 1.8.5 on the same machine performs poetry /home/<user>/.local/pipx/venvs/poetry@1.8.5/bin/poetry init successfully.

Workarounds

Setting the following configuration makes Poetry 2.x work without errors:

/home/<user>/.local/pipx/venvs/poetry@2-1-2/bin/poetry config virtualenvs.use-poetry-python true

Poetry Installation Method

pipx

Operating System

Ubuntu 22.04

Poetry Version

2.1.2

Poetry Configuration
cache-dir = "/home/<user>/.cache/pypoetry"
data-dir = "/home/<user>/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python"  # /home/<user>/.local/share/pypoetry/python
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/<user>/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the provided pipx, pyenv, and Poetry 2.1.2 commands, then compare it with Poetry 1.8.5 and the virtualenvs.use-poetry-python workaround. Trace the findpython path involved in the reported interpreter command; the work is done when the original setup completes successfully without requiring that configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.