-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry picks wrong platform when resolving a local poetry project dependency #8681
Comments
sources are a poetry special: there is no way to express them in standard project metadata and so in general project A cannot know about sources defined in project B. what you are trying to do will not work, you'll have to be explicit about such things in your top-level project please close |
So I cannot use Poetry if I have a dependency that relies on an OS-specific source. Is that correct? |
your top-level project cannot rely on anything your dependencies say about sources. Your mental model should be: imagine that the dependency has been published to pypi, and all source information is therefore unavailable - because it just isn't part of the wheel metadata |
Thanks for the clarification! Let's say I explicitly add the source For my main issue: I am on |
a.b.c+local is a match for a.b.c, you still are relying on the unavailable source information to disambiguate |
I may be misunderstanding.
|
The requirement |
I ran into (almost exactly) the same issue today, so I thought it best to add my comment here. I have torch 2.1.0 in my primary source and 2.1.0+cu118 in my supplemental source. I would expect poetry to try to install from the primary source before the supplemental one, but it's not. Something else that's new, and I think related, is that I get a lot of messages like this about my supplemental source when running
All these dependencies are available on the primary source, so I don't think poetry should query the supplemental one (according to the documentation https://python-poetry.org/docs/repositories/#supplemental-package-sources) This all worked as expected a few days ago, but it broke on poetry 1.5.1 (which I hadn't updated), and wasn't fixed by updating to 1.7.1. I'm running this on MacOS 14.0 (ARM) with python 3.11.4 |
@chielk none of that is new and it is discussed in lots of other issues, please search for duplicates. this issue is specifically about sources that are mentioned in a dependency of the top-level project - and it should be closed, because everything here is working as expected |
The Even if you remove the sources, you have
Why would poetry pick |
because that's what the python packaging standards say is the correct behaviour https://packaging.python.org/en/latest/specifications/version-specifiers/#version-matching
Therefore when matching "=2.1.0" we MUST ignore the "+cpu" on the candidate version "2.1.0+cpu", and it becomes a match |
Ah, now I understand, thanks! That's a tricky one. My easiest solution is probably to work with, e.g.
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Poetry version: 1.7.0
Python version: 3.12.0
OS version and name: macOS 12.5.1
pyproject.toml: The two pyproject.toml files to recreate the issue
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.Issue
I created two local poetry projects. The first (
local_dependency
) defines a platform-specific dependency. The second (test_project
) installs the first project using the wrong platform.Steps to reproduce
local_dependency
andtest_project
withpoetry new
local_dependency/pyproject.toml
I have:test_project/pyproject.toml
I have:Note that I need to re-add the
torch_cpu
source otherwisepoetry lock
gives meRepository "torch_cpu" does not exist.
. I don't know if this is another bug or expected behavior (sources not being imported from local poetry project dependencies) Edit: this part is expected behavior; see dimbleby's answerlocal_project/
,poetry lock
andpoetry install
run fine. Poetry uses thepypi
source for darwin as expected.test_project/
,poetry lock
runs fine butpoetry install
gives a runtime errorUnable to find installation candidates for torch (2.1.0+cpu)
. Poetry tries to install the local dependency as if it was in linux. It seems the platform tag is not transited in the correct wayThe text was updated successfully, but these errors were encountered: