python-poetry / python-poetry/poetry

Poetry doesn't check extra sources for package

Open
#4,854 5 comments 8 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

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Ubuntu 20.04.3 LTS (Focal Fossa)
  • Poetry version: 1.1.12
  • Contents of your pyproject.toml file:
[tool.poetry]
name = "shit"
version = "0.1.0"
description = ""
authors = ["None"]

[tool.poetry.dependencies]
python = "^3.7"
tensorflow = "1.15.5"

[tool.poetry.dev-dependencies]

[[tool.poetry.source]]
name = "tensorflow"
url = "https://tf.kmtea.eu/whl/stable.html"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Issue

Poetry is incapable of finding a package from a custom source. The package is also part of pypi, but not for arm64 architectures, so I need to add a custom source to search for it, but it doesn't try to look for it there. This results on poetry add tensorflow==1.15.5 failing on arm64 architectures.

I have added a custom source where this is available (and it works if you do pip install tensorflow==1.15.5 -f https://tf.kmtea.eu/whl/stable.html) but poetry never looks in that source for the package, so the build fails with:

Unable to find installation candidates for tensorflow (1.15.5)

  at ~/.poetry/lib/poetry/installation/chooser.py:74 in choose_for
       70│             links.append(link)
       71│
       72│         if not links:
       73│             raise RuntimeError(
    →  74│                 "Unable to find installation candidates for {}".format(package)
       75│             )
       76│
       77│         # Get the best link
       78│         chosen = max(links, key=lambda link: self._sort_key(package, link))

I have also tried with:

[tool.poetry.dependencies]
python = "^3.7"
tensorflow = {version = "1.15.5", source = "tensorflow"}

but it doesn't work either.

Any tips? Thanks!

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 with the package-selection path reported in poetry/installation/chooser.py, then reproduce the failure using the provided pyproject.toml and poetry add tensorflow==1.15.5 command. Confirm that the custom source configuration is considered and that the command finds an installation candidate for tensorflow 1.15.5.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.