-
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
Extra marker is ignored in poetry install
, but respected in pip install
#7748
Comments
you are stretching poetry quite far here, I dunno whether I'd expect this to work or not. But I'd try an explicit |
package-b = [
{version = "^0.1.0", source = "pypi", markers = "extra == 'repo'", optional = true},
{path = "../package_b", develop = true, markers = "extra == 'local'", optional = true},
] This doesn't seem to work either. Interestingly, even with explicitly specifying the source, only the path dependency makes it into [[package]]
name = "package-b"
version = "0.1.0"
description = ""
category = "main"
optional = true
python-versions = "^3.9"
files = []
develop = true
[package.source]
type = "directory"
url = "../package_b"
[extras]
local = ["package-b", "package-b"]
repo = ["package-b", "package-b"] |
probably duplicate #7722 then, there's a suggested fix in there if you want to run with it |
Thanks for the help. It could be the same underlying issue. I installed Poetry from source and tried the suggested fix, but the code path doesn't seem to be hitting that method. I ran it in pdb and put a breakpoint there to be sure. After looking at that issue, I tried switching the order of the dependencies. Putting the path dependency first, and the PyPI dependency second raises the I tried swapping out requests = [
{version = "^2.28.2", source = "pypi", markers = "extra == 'repo'", optional = true},
{path = "../requests", develop = true, markers = "extra == 'local'", optional = true},
] I'm happy to help with a fix, but I don't really know enough about Poetry's internals to suggest one. |
Did some digging on this on this over the weekend: Changing There's weird behaviour at install time, though. No |
It would be nice to have this feature working in poetry because it's extremely useful to have a separate version depending on the environment and be able to control that with |
Agreed! I'm facing a similar issue where I want to install |
For me using
Results in poetry (1.7.1) trying to install both version (i.e.
And then next time
Note first time it was installing torch+cuda but it didn't install the cuda (nvidia*) packages. Second time it installed the wrong nvidia packages (from torch 2.2.0) Also I'd prefer to be able to add torch to optional groups, each with different versions because my project generates AWS Sagemaker ML Pipelines and I need to build/test containers - each with it's own requirements - so I'm using/abusing poetry to create separate environments for each step (in the container). My build script itself only needs sagemaker/boto3 but my tests/container Dockerfiles install specific groups from my poetry file. I know this pushes poetry beyond it's intended use. |
So part of what's happening here is I have 3 sources, our private codeartifact repo (which has PyPI as upstream) and two pytorch sources (CPU and GPU). When I added So I've replaced |
IMHO fixing this would provide the last missing piece to be able to use PyTorch and Poetry in all situations, using the setup outline in this earlier comment. Poetry currently supports a single hardware variant of pytorch, but not switching between hardware variants, due this issue. This would be an awesome capability. |
Hello Everyone, Is there a progress on this issue? |
-vvv
option) and have included the output below.Issue
If my understanding is correct, a dependency like this should install the PyPI repository version of the dependency if installed as
package_a[repo]
, and the path dependency if installed aspackage_a{local]
:pip install -e .[local]
installs the path dependency, andpip install -e .[repo]
fails becausepackage_b
doesn't exist (as it should).poetry install -E local
andpoetry install -E repo
both install the path dependency, though.Use case
I have quite a few repos, all using Poetry, that I would like to install locally with a single
poetry install
at the top of the dependency tree.Example dependency tree:
If you alter the
package_b
dependency specification to add the right extras:You could use
poetry install -E local
to install the whole tree for local development.pip install -e .[local]
seems to work this way, unless I'm missing something.I'm aware that including path dependencies outside of groups specifies the full path (not relative) in
PKG-INFO
. That's not a problem for us, because the packages are only being uploaded to a private PyPI.The text was updated successfully, but these errors were encountered: