Skip to content
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

Multiple Platform syntax not working #3561

Closed
3 tasks done
Leon0402 opened this issue Jan 11, 2021 · 8 comments
Closed
3 tasks done

Multiple Platform syntax not working #3561

Leon0402 opened this issue Jan 11, 2021 · 8 comments
Labels
kind/bug Something isn't working as expected status/needs-reproduction Issue needs a minimal reproduction to be confirmed

Comments

@Leon0402
Copy link

  • 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: Linux, Windows

  • Poetry version: 1.1.0 - 1.4.0

Issue

Specifying multiple entries for a dependency doesn't work. This basically continues #2138, which has been marked as resolved.

I tried several combinations and none worked. Among the things I tried were the following things:

torch = [
{url = "https://download.pytorch.org/whl/cu102/torch-1.6.0-cp38-cp38-win_amd64.whl", python = "~3.8", markers = "sys_platform == 'win32'" },
{version = "1.6.0", markers = "sys_platform != 'win32'" }
]

torch = [
{url = "https://download.pytorch.org/whl/cu102/torch-1.6.0-cp38-cp38-win_amd64.whl", python = "~3.8", platform = "win32" },
{version = "1.6.0", platform = "linux || darwin" }
]

I tried both and similar variations of the two above with poetry 1.1.0, 1.1.1, 1.1.2, 1.1.3 and 1.1.4

In all cases, the first entry was always used no matter what platform I was on. So on Linux it downloaded the windows wheel. And On Windows, if you changed the order, it took the instructions for linux / mac os.

@Leon0402 Leon0402 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 11, 2021
@johnmacnamararseg
Copy link

might be same as what I ran into here 3511.

submitted PR 3512 to fix but waiting for triage and response

@Leon0402
Copy link
Author

Leon0402 commented Jan 13, 2021

I'm not quite sure, it doesn't work on 1.1.3 either (whereas you reported the issue is just in 1.1.4).

I ran it in debug mode and got the following output:

   0: Duplicate dependencies for torch
   0: Merging requirements for torch (=1.6.0)
   0: Duplicate dependencies for torchvision
   0: Merging requirements for torchvision (=0.7.0)

Before that poetry also needs ages, seems almost stuck.

The documentation in the code seems quite weird:

        # Searching for duplicate dependencies
        #
        # If the duplicate dependencies have the same constraint,
        # the requirements will be merged.
        #
        # For instance:
        #   - enum34; python_version=="2.7"
        #   - enum34; python_version=="3.3"
        #
        # will become:
        #   - enum34; python_version=="2.7" or python_version=="3.3"
        #
        # If the duplicate dependencies have different constraints
        # we have to split the dependency graph.
        #
        # An example of this is:
        #   - pypiwin32 (220); sys_platform == "win32" and python_version >= "3.6"
        #   - pypiwin32 (219); sys_platform == "win32" and python_version < "3.6"

Obviously if I specify different sources like here url and pipy, I don't want anythin to be merged to an or.

@LironEr
Copy link

LironEr commented Jun 8, 2021

Im using the latest poetry (1.2.0a1)

when using version & markers it's working ok

[tool.poetry.dependencies]
python = "~3.7"
example-package = [
    { version = "0.5.0", markers = "sys_platform != 'darwin'" },
    { version = "0.4.1", markers = "sys_platform == 'darwin'" },
]

on mac poetry install 0.4.1, and generate lock file for both versions

But when using path & markers, it just takes the first entry in the package array

example-package = [
    { version = "0.5.0", markers = "sys_platform != 'darwin'" },
    { path = "libs/example-package-0.5-mac.tar.gz", markers = "sys_platform == 'darwin'" },
]

regardless my OS poetry install & lock only 0.5

@xinyangyuan
Copy link

Im using the latest poetry (1.2.0a1)

when using version & markers it's working ok

[tool.poetry.dependencies]
python = "~3.7"
example-package = [
    { version = "0.5.0", markers = "sys_platform != 'darwin'" },
    { version = "0.4.1", markers = "sys_platform == 'darwin'" },
]

on mac poetry install 0.4.1, and generate lock file for both versions

But when using path & markers, it just takes the first entry in the package array

example-package = [
    { version = "0.5.0", markers = "sys_platform != 'darwin'" },
    { path = "libs/example-package-0.5-mac.tar.gz", markers = "sys_platform == 'darwin'" },
]

regardless my OS poetry install & lock only 0.5

same issue when using URL & markers:

torch = [
    { version = "^1.9.0", platform = "darwin" },
    { url = "https://download.pytorch.org/whl/cu111/torch-1.9.0%2Bcu111-cp39-cp39-win_amd64.whl", platform = "win32" },
]

@Yevgnen
Copy link

Yevgnen commented Dec 6, 2021

Same issue here...

@dimbleby
Copy link
Contributor

seems to work fine on master

@neersighted neersighted added status/needs-reproduction Issue needs a minimal reproduction to be confirmed and removed status/triage This issue needs to be triaged labels Oct 4, 2022
@neersighted
Copy link
Member

Unable to reproduce on 1.2.x -- please open a issue with a detailed reproduction if you think you are running into this.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2022
m4rk4 added a commit to m4rk4/BuoyantUnrealisticModule that referenced this issue Jun 8, 2023
Copy link

github-actions bot commented Mar 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/needs-reproduction Issue needs a minimal reproduction to be confirmed
Projects
None yet
Development

No branches or pull requests

7 participants