python-poetry / python-poetry/poetry

Transient RuntimeError - unable to find installation candidates

Open
#8,139 13 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.
    • Did not do this, error is transient

Issue

We experience rolling, transient runtime errors in our build pipelines where poetry cannot find installation candidates for a package.

To combat this, we currently run poetry install --no-ansi || poetry install --no-ansi, since a second poetry run usually works fine. Still we experience situations where a third attempt is required for a successful build.

Here is an example, where the in the first failure it cannot find candidates for pyasn1, then in the retry it cannot find idna.

We would welcome an overall fix, or recommendations for our pipeline that could make this happen less often.

+ poetry env use python3.9
Creating virtualenv owid-datautils in /var/lib/buildkite-agent/builds/etl-build-1-6/our-world-in-data/owid-datautils-unit-tests/lib/datautils/.venv
Using virtualenv: /var/lib/buildkite-agent/builds/etl-build-1-6/our-world-in-data/owid-datautils-unit-tests/lib/datautils/.venv
+ poetry install --no-ansi
Installing dependencies from lock file
 
Package operations: 150 installs, 1 update, 0 removals
 
  • Installing pyasn1 (0.5.0)
  • Installing six (1.16.0)
 
  RuntimeError
 
  Unable to find installation candidates for pyasn1 (0.5.0)
 
  at /usr/local/lib/poetry/venv/lib/python3.10/site-packages/poetry/installation/chooser.py:76 in choose_for
       72│
       73│             links.append(link)
       74│
       75│         if not links:
    →  76│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       77│
       78│         # Get the best link
       79│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       80│
 
+ poetry install --no-ansi
Installing dependencies from lock file
 
Package operations: 149 installs, 1 update, 0 removals
 
  • Installing pyasn1 (0.5.0)
  • Installing asttokens (2.2.1)
  • Installing cachetools (5.3.1)
  • Installing certifi (2023.5.7)
  • Installing charset-normalizer (3.1.0)
  • Installing executing (1.2.0)
  • Installing idna (3.4)
  • Installing jmespath (1.0.1)
  • Installing markupsafe (2.1.3)
  • Installing mdurl (0.1.2)
  • Installing packaging (23.1)
  • Installing parso (0.8.3)
  • Installing protobuf (4.23.3)
  • Installing ptyprocess (0.7.0)
  • Installing pure-eval (0.2.2)
  • Installing pyasn1-modules (0.3.0)
  • Installing pycparser (2.21)
  • Installing pyparsing (3.1.0)
  • Installing python-dateutil (2.8.2)
  • Installing rsa (4.9)
  • Installing smmap (5.0.0)
  • Installing traitlets (5.9.0)
  • Installing urllib3 (1.26.16)
  • Installing wcwidth (0.2.6)
  • Installing zipp (3.15.0)
 
  RuntimeError
 
  Unable to find installation candidates for idna (3.4)
 
  at /usr/local/lib/poetry/venv/lib/python3.10/site-packages/poetry/installation/chooser.py:76 in choose_for
       72│
       73│             links.append(link)
       74│
       75│         if not links:
    →  76│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       77│
       78│         # Get the best link
       79│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       80│
 
🚨 Error: The command exited with status 1
user command error: exit status 1

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

The traceback points to poetry/installation/chooser.py:76; start by reproducing the supplied project’s poetry install -vvv failure and comparing candidate lookup with a successful retry. Done means the transient installation failure is explained and addressed with regression coverage or documented pipeline guidance.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.