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

Unable to install Pytorch (M1 Mac prerelease) #1093

Closed
1 task done
pikeas opened this issue May 24, 2022 · 3 comments
Closed
1 task done

Unable to install Pytorch (M1 Mac prerelease) #1093

pikeas opened this issue May 24, 2022 · 3 comments
Labels
🐛 bug Something isn't working
Milestone

Comments

@pikeas
Copy link

pikeas commented May 24, 2022

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

Steps to reproduce

# .pdm.toml
[python]
path = "/Users/pikeas/.asdf/installs/python/3.9.13/bin/python3.9"
# pyproject.toml
[project]
# Pytorch supports 3.9, not yet compatible with 3.10
requires-python = "~=3.9.0"

[[tool.pdm.source]]
url = "https://download.pytorch.org/whl/nightly/cpu"
verify_ssl = true
name = "internal"

[build-system]
requires = ["pdm-pep517>=0.12.0"]
build-backend = "pdm.pep517.api"
$ pdm add torch --pre -v

Actual behavior

Pytorch isn't installed, pdm does not find a compatible distribution.

Adding packages to default dependencies: torch
======== Start resolving requirements ========
  torch
  python>=3.9,<3.10
  Adding requirement torch
	Found matching candidates:
	  <Candidate torch 1.13.0.dev20220524+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220524 from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220523+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220523 from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220522+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220522 from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220521+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.13.0.dev20220521 from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.12.0.dev20220520+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  <Candidate torch 1.12.0.dev20220520 from https://download.pytorch.org/whl/nightly/cpu/torch/>
	  ... [1201 more candidate(s)]
  Adding requirement python>=3.9,<3.10
======== Starting round 0 ========
Resolving: new pin python >=3.9,<3.10
======== Ending round 0 ========
======== Starting round 1 ========
  Adding requirement typing-extensions(from torch 1.13.0.dev20220524+cpu)
	Found matching candidates:
	  <Candidate typing-extensions 4.2.0 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 4.1.1 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 4.1.0 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 4.0.1 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 4.0.0 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 3.10.0.2 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 3.10.0.1 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 3.10.0.0 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 3.7.4.3 from https://pypi.org/simple/typing-extensions/>
	  <Candidate typing-extensions 3.7.4.2 from https://pypi.org/simple/typing-extensions/>
	  ... [36 more candidate(s)]
Resolving: new pin torch 1.13.0.dev20220524+cpu
======== Ending round 1 ========
======== Starting round 2 ========
Resolving: new pin typing-extensions 4.2.0
======== Ending round 2 ========
======== Starting round 3 ========
======== Resolution Result ========
Stable pins:
             python None
              torch 1.13.0.dev20220524+cpu
  typing-extensions 4.2.0
	Found matching candidates:
	  <Candidate torch 1.13.0.dev20220524+cpu from https://download.pytorch.org/whl/nightly/cpu/torch/>
	Found matching candidates:
	  <Candidate typing-extensions 4.2.0 from https://pypi.org/simple/typing-extensions/>
🔒 Lock successful
Changes are written to pdm.lock.
Changes are written to pyproject.toml.
Synchronizing working set with lock file: 1 to add, 0 to update, 0 to remove

Could not find a version that satisfies the requirement torch==1.13.0.dev20220524+cpu (from versions: 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0.dev20220325, 1.12.0.dev20220326, 1.12.0.dev20220327, 1.12.0.dev20220328, 1.12.0.dev20220329, 1.12.0.dev20220330, 1.12.0.dev20220331, 1.12.0.dev20220401, 1.12.0.dev20220402, 1.12.0.dev20220403, 1.12.0.dev20220404, 1.12.0.dev20220405, 1.12.0.dev20220407, 1.12.0.dev20220408, 1.12.0.dev20220409, 1.12.0.dev20220410, 1.12.0.dev20220411, 1.12.0.dev20220412, 1.12.0.dev20220413, 1.12.0.dev20220415, 1.12.0.dev20220416, 1.12.0.dev20220417, 1.12.0.dev20220418, 1.12.0.dev20220419, 1.12.0.dev20220420, 1.12.0.dev20220421, 1.12.0.dev20220422, 1.12.0.dev20220423, 1.12.0.dev20220424, 1.12.0.dev20220425, 1.12.0.dev20220426, 1.12.0.dev20220427, 1.12.0.dev20220428, 1.12.0.dev20220429, 1.12.0.dev20220430, 1.12.0.dev20220501, 1.12.0.dev20220502, 1.12.0.dev20220503, 1.12.0.dev20220504, 1.12.0.dev20220505, 1.12.0.dev20220506, 1.12.0.dev20220507, 1.12.0.dev20220508, 1.12.0.dev20220509, 1.12.0.dev20220510, 1.12.0.dev20220511, 1.12.0.dev20220512, 1.12.0.dev20220513, 1.12.0.dev20220514, 1.12.0.dev20220515, 1.12.0.dev20220516, 1.12.0.dev20220517, 1.12.0.dev20220518, 1.12.0.dev20220519, 1.12.0.dev20220520, 1.13.0.dev20220521, 1.13.0.dev20220522, 1.13.0.dev20220523, 1.13.0.dev20220524)
Install torch 1.13.0.dev20220524+cpu failed
Error occurs:
Traceback (most recent call last):
  File "/Users/pikeas/.asdf/installs/python/3.9.13/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 207, in install_candidate
    self.manager.install(can)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/manager.py", line 39, in install
    installer(prepared.build(), self.environment, prepared.direct_url())
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 317, in build
    self.obtain(allow_all=False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 356, in obtain
    ireq.link = populate_link(finder, ireq, False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/utils.py", line 367, in populate_link
    candidate = finder.find_requirement(ireq, upgrade)
  File "/Users/pikeas/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 946, in find_requirement
    raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for torch==1.13.0.dev20220524+cpu
  Retry failed jobs
Could not find a version that satisfies the requirement torch==1.13.0.dev20220524+cpu (from versions: 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0.dev20220325, 1.12.0.dev20220326, 1.12.0.dev20220327, 1.12.0.dev20220328, 1.12.0.dev20220329, 1.12.0.dev20220330, 1.12.0.dev20220331, 1.12.0.dev20220401, 1.12.0.dev20220402, 1.12.0.dev20220403, 1.12.0.dev20220404, 1.12.0.dev20220405, 1.12.0.dev20220407, 1.12.0.dev20220408, 1.12.0.dev20220409, 1.12.0.dev20220410, 1.12.0.dev20220411, 1.12.0.dev20220412, 1.12.0.dev20220413, 1.12.0.dev20220415, 1.12.0.dev20220416, 1.12.0.dev20220417, 1.12.0.dev20220418, 1.12.0.dev20220419, 1.12.0.dev20220420, 1.12.0.dev20220421, 1.12.0.dev20220422, 1.12.0.dev20220423, 1.12.0.dev20220424, 1.12.0.dev20220425, 1.12.0.dev20220426, 1.12.0.dev20220427, 1.12.0.dev20220428, 1.12.0.dev20220429, 1.12.0.dev20220430, 1.12.0.dev20220501, 1.12.0.dev20220502, 1.12.0.dev20220503, 1.12.0.dev20220504, 1.12.0.dev20220505, 1.12.0.dev20220506, 1.12.0.dev20220507, 1.12.0.dev20220508, 1.12.0.dev20220509, 1.12.0.dev20220510, 1.12.0.dev20220511, 1.12.0.dev20220512, 1.12.0.dev20220513, 1.12.0.dev20220514, 1.12.0.dev20220515, 1.12.0.dev20220516, 1.12.0.dev20220517, 1.12.0.dev20220518, 1.12.0.dev20220519, 1.12.0.dev20220520, 1.13.0.dev20220521, 1.13.0.dev20220522, 1.13.0.dev20220523, 1.13.0.dev20220524)
Install torch 1.13.0.dev20220524+cpu failed
Error occurs:
Traceback (most recent call last):
  File "/Users/pikeas/.asdf/installs/python/3.9.13/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 207, in install_candidate
    self.manager.install(can)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/manager.py", line 39, in install
    installer(prepared.build(), self.environment, prepared.direct_url())
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 317, in build
    self.obtain(allow_all=False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 356, in obtain
    ireq.link = populate_link(finder, ireq, False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/utils.py", line 367, in populate_link
    candidate = finder.find_requirement(ireq, upgrade)
  File "/Users/pikeas/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 946, in find_requirement
    raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for torch==1.13.0.dev20220524+cpu

ERRORS:
add torch failed:
Traceback (most recent call last):
  File "/Users/pikeas/.asdf/installs/python/3.9.13/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 207, in install_candidate
    self.manager.install(can)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/manager.py", line 39, in install
    installer(prepared.build(), self.environment, prepared.direct_url())
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 317, in build
    self.obtain(allow_all=False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/models/candidates.py", line 356, in obtain
    ireq.link = populate_link(finder, ireq, False)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/utils.py", line 367, in populate_link
    candidate = finder.find_requirement(ireq, upgrade)
  File "/Users/pikeas/.local/pipx/shared/lib/python3.9/site-packages/pip/_internal/index/package_finder.py", line 946, in find_requirement
    raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for torch==1.13.0.dev20220524+cpu

Traceback (most recent call last):
  File "/Users/pikeas/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 232, in main
    return Core().main(args)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 167, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 162, in main
    f(options.project, options)
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/commands/add.py", line 55, in handle
    actions.do_add(
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 268, in do_add
    do_sync(
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 209, in do_sync
    handler.synchronize()
  File "/Users/pikeas/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/installers/synchronizers.py", line 374, in synchronize
    raise InstallationError("Some package operations are not complete yet")
pdm.exceptions.InstallationError: Some package operations are not complete yet

Set up clean pdm project, add Pytorch nightly as extra source, add Pytorch prerelease to project on an M1 Mac.

Expected behavior

Pytorch is installed.

Environment Information

PDM version:        1.15.0
Python Interpreter: /Users/pikeas/.asdf/installs/python/3.9.13/bin/python3.9 (3.9)
Project Root:       /Users/pikeas/repo/src/py
Project Packages:   /Users/pikeas/repo/src/py/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.13",
  "os_name": "posix",
  "platform_machine": "arm64",
  "platform_release": "21.4.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000",
  "python_full_version": "3.9.13",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "darwin"
}
@pikeas pikeas added the 🐛 bug Something isn't working label May 24, 2022
@pikeas
Copy link
Author

pikeas commented May 24, 2022

Also tried == per related issue #694:

dependencies = ["torch==1.13.0.dev20220524+cpu"]

Same result.

Also, why does pdm add the dependency to pyproject.toml when the installation failed?

@frostming
Copy link
Collaborator

frostming commented May 25, 2022

The source is of find_links type, you need to specify that

[[tool.pdm.source]]
url = "https://download.pytorch.org/whl/nightly/cpu"
verify_ssl = true
name = "internal"
type = "find_links"

Update: This suggestion turned out to be wrong. The url is not a find_links type

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2022
@frostming frostming reopened this Jun 15, 2022
@frostming frostming added this to the Release 2.0 milestone Jun 16, 2022
frostming added a commit that referenced this issue Jun 16, 2022
frostming added a commit that referenced this issue Jun 24, 2022
frostming added a commit that referenced this issue Jun 24, 2022
frostming added a commit that referenced this issue Jun 28, 2022
frostming added a commit that referenced this issue Jun 28, 2022
@nightblure
Copy link

any updates?

two questions: what should the source section look like and how to add a version specifier to such packages?

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

3 participants