python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.06k stars 2.25k forks source link

Poetry doesn't check extra sources for package #4854

Open JaviFuentes94 opened 2 years ago

JaviFuentes94 commented 2 years ago

[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:
```python
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!

JaviFuentes94 commented 2 years ago

Related #4659

stumpylog commented 2 years ago

I'm assuming this is still an issue? It basically prevents the usage of poetry for projects which support multiple arches but don't want to compile packages which can be found compiled in another repository (example scipy or numpy for armv7).

IvanaGyro commented 1 year ago

This seems still an issue now on the master branch.

xbug42 commented 5 months ago

Is there any plan to fix this ? This is Just to know if I should wait for a fix or not... Thx !

dimbleby commented 5 months ago

this is not broken and should be closed

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

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

is the current syntax