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

Issues with cross-platform lockfiles #2066

Closed
1 task done
bilelomrani1 opened this issue Jun 28, 2023 · 1 comment
Closed
1 task done

Issues with cross-platform lockfiles #2066

bilelomrani1 opened this issue Jun 28, 2023 · 1 comment
Labels
🐛 bug Something isn't working

Comments

@bilelomrani1
Copy link
Contributor

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

On a MacOS machine, create the following pyproject.toml

[project]
name = ""
version = ""
description = ""
authors = [
    {name = "", email = ""},
]
dependencies = []
requires-python = ">=3.9"

[project.optional-dependencies]
cpu = [
    'torch==2.0.1 ; sys_platform == "darwin"',
    'torch==2.0.1+cpu ; sys_platform == "linux"',
]

Run the following commands:

$ pdm config pypi.torch.url https://download.pytorch.org/whl/cpu -v
$ pdm lock -G cpu -v
$ pdm sync -G cpu -v

Actual behavior

$ pdm lock -G cpu -v 
STATUS: Resolving dependencies
pdm.termui: ======== Start resolving requirements ========
pdm.termui:   torch==2.0.1+cpu; sys_platform == "linux"
pdm.termui:   python>=3.9
pdm.termui:   Adding requirement torch==2.0.1+cpu; sys_platform == "linux"
pdm.termui:   Adding requirement python>=3.9
pdm.termui: ======== Starting round 0 ========
STATUS: Resolving: new pin python>=3.9
pdm.termui: Pinning: python None
pdm.termui: ======== Ending round 0 ========
pdm.termui: ======== Starting round 1 ========
pdm.termui:   Adding requirement filelock(from torch 2.0.1+cpu)
pdm.termui:   Adding requirement typing-extensions(from torch 2.0.1+cpu)
pdm.termui:   Adding requirement sympy(from torch 2.0.1+cpu)
pdm.termui:   Adding requirement networkx(from torch 2.0.1+cpu)
pdm.termui:   Adding requirement jinja2(from torch 2.0.1+cpu)
STATUS: Resolving: new pin torch 2.0.1+cpu
pdm.termui: Pinning: torch 2.0.1+cpu
pdm.termui: ======== Ending round 1 ========
pdm.termui: ======== Starting round 2 ========
STATUS: Resolving: new pin filelock 3.12.2
pdm.termui: Pinning: filelock 3.12.2
pdm.termui: ======== Ending round 2 ========
pdm.termui: ======== Starting round 3 ========
pdm.termui:   Adding requirement MarkupSafe>=2.0(from jinja2 3.1.2)
STATUS: Resolving: new pin jinja2 3.1.2
pdm.termui: Pinning: jinja2 3.1.2
pdm.termui: ======== Ending round 3 ========
pdm.termui: ======== Starting round 4 ========
STATUS: Resolving: new pin networkx 3.1
pdm.termui: Pinning: networkx 3.1
pdm.termui: ======== Ending round 4 ========
pdm.termui: ======== Starting round 5 ========
pdm.termui:   Adding requirement mpmath>=0.19(from sympy 1.12)
STATUS: Resolving: new pin sympy 1.12
pdm.termui: Pinning: sympy 1.12
pdm.termui: ======== Ending round 5 ========
pdm.termui: ======== Starting round 6 ========
STATUS: Resolving: new pin typing-extensions 4.6.3
pdm.termui: Pinning: typing-extensions 4.6.3
pdm.termui: ======== Ending round 6 ========
pdm.termui: ======== Starting round 7 ========
STATUS: Resolving: new pin MarkupSafe 2.1.3
pdm.termui: Pinning: MarkupSafe 2.1.3
pdm.termui: ======== Ending round 7 ========
pdm.termui: ======== Starting round 8 ========
STATUS: Resolving: new pin mpmath 1.3.0
pdm.termui: Pinning: mpmath 1.3.0
pdm.termui: ======== Ending round 8 ========
pdm.termui: ======== Starting round 9 ========
pdm.termui: ======== Resolution Result ========
pdm.termui: Stable pins:
pdm.termui:              python None
pdm.termui:               torch 2.0.1+cpu
pdm.termui:            filelock 3.12.2
pdm.termui:              jinja2 3.1.2
pdm.termui:            networkx 3.1
pdm.termui:               sympy 1.12
pdm.termui:   typing-extensions 4.6.3
pdm.termui:          markupsafe 2.1.3
pdm.termui:              mpmath 1.3.0
STATUS: Fetching hashes for resolved packages...
pdm.termui: Fetching hashes for filelock@3.12.2
pdm.termui: Fetching hashes for typing-extensions@4.6.3
pdm.termui: Fetching hashes for jinja2@3.1.2
pdm.termui: Fetching hashes for sympy@1.12
pdm.termui: Fetching hashes for networkx@3.1
pdm.termui: Fetching hashes for mpmath@1.3.0
pdm.termui: Fetching hashes for MarkupSafe@2.1.3
pdm.termui: Fetching hashes for torch@2.0.1+cpu
🔒 Lock successful
Changes are written to pdm.lock.

$ pdm sync -G cpu -v
STATUS: Resolving packages from lockfile...
STATUS: Fetching hashes for resolved packages...
All packages are synced to date, nothing to do.

🎉 All complete!

Expected behavior

When syncing, torch for MacOS should be installed. The dependency 'torch==2.0.1 ; sys_platform == "darwin"' is currently ignored.

Environment Information

$ pdm info && pdm info --env
PDM version:
  2.7.4
Python Interpreter:
  /Users/bilelomrani/.pyenv/versions/3.9.16/envs/test-pdm/bin/python (3.9)
Project Root:
  /Users/bilelomrani/Documents/ILLUIN.nosync/test-torch-package
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.9.16",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "22.3.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64",
  "python_full_version": "3.9.16",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "darwin"
}
@bilelomrani1 bilelomrani1 added the 🐛 bug Something isn't working label Jun 28, 2023
@frostming
Copy link
Collaborator

frostming commented Jun 29, 2023

We currently not support multiple specifications for the same package.

As a workaround, you put them in different groups and create two lockfiles for them separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants