-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Description
Reproduce:
- Install the latest poetry
- Clear poetry caches with
poetry cache clear --all . - Create a new poetry project with
poetry init, specify no dependencies. - Add torch:
poetry add torch
Using version ^2.3.0 for torch
Updating dependencies
Resolving dependencies... (2.6s)
Package operations: 1 install, 0 updates, 0 removals
- Installing torch (2.3.0): Failed
RuntimeError
Unable to find installation candidates for torch (2.3.0)
at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/chooser.py:74 in choose_for
70│
71│ links.append(link)
72│
73│ if not links:
→ 74│ raise RuntimeError(f"Unable to find installation candidates for {package}")
75│
76│ # Get the best link
77│ chosen = max(links, key=lambda link: self._sort_key(package, link))
78│
Cannot install torch.
I'm on MacOS 13.6.6 (22G630) with Apple M1 Pro, but the same thing fails in the docker container running inside the VM on MacOS.
I guess the problem is that torch 2.3.0 is not available on Apple hardware:
$ pip install torch==2.3.0
ERROR: Could not find a version that satisfies the requirement torch==2.3.0 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2)
ERROR: No matching distribution found for torch==2.3.0
However, poetry tries to reach for the latest 2.3.0 version instead of the 2.2.2 version that is available on the Apple hardware:
poetry add torch==2.2.0 works.
pip install torch correctly selects the available 2.2.2 version.
I would expect poetry to behave exactly like pip and select the latest version available for the platform unless the version is explicitly specified.
Workarounds
Torch 2.3.0 is not available on Apple hardware, but 2.2.2 is available:
poetry add torch==2.2.0
Poetry Installation Method
pipx
Operating System
MacOS 13.6.6 (22G630) with Apple M1 Pro
Poetry Version
Poetry (version 1.8.3)
Poetry Configuration
cache-dir = "/Users/olehlokshyn/Library/Caches/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = false
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/olehlokshyn/Library/Caches/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = truePython Sysconfig
No response
Example pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["John Doe <[email protected]>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.9"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"Poetry Runtime Logs
Skipping wheel torch-2.3.0-cp310-cp310-manylinux1_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp310-cp310-manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp310-cp310-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp310-none-macosx_11_0_arm64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp311-cp311-manylinux1_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp311-cp311-manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp311-cp311-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp311-none-macosx_11_0_arm64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp312-cp312-manylinux1_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp312-cp312-manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp312-cp312-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp312-none-macosx_11_0_arm64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp38-cp38-manylinux1_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp38-cp38-manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp38-cp38-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp38-none-macosx_11_0_arm64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp39-cp39-manylinux1_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp39-cp39-manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp39-cp39-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-2.3.0-cp39-none-macosx_11_0_arm64.whl as this is not supported by the current environment
Stack trace:
6 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:285 in _execute_operation
283│
284│ try:
→ 285│ result = self._do_execute_operation(operation)
286│ except EnvCommandError as e:
287│ if e.e.returncode == -2:
5 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:395 in _do_execute_operation
393│ return 0
394│
→ 395│ result: int = getattr(self, f"_execute_{method}")(operation)
396│
397│ if result != 0:
4 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:527 in _execute_update
525│
526│ def _execute_update(self, operation: Install | Update) -> int:
→ 527│ status_code = self._update(operation)
528│
529│ self._save_url_reference(operation)
3 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:586 in _update
584│
585│ def _update(self, operation: Install | Update) -> int:
→ 586│ return self._install(operation)
587│
588│ def _remove(self, package: Package) -> int:
2 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:558 in _install
556│ archive = self._download_link(operation, Link(package.source_url))
557│ else:
→ 558│ archive = self._download(operation)
559│
560│ operation_message = self.get_operation_message(operation)
1 ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:736 in _download
734│
735│ def _download(self, operation: Install | Update) -> Path:
→ 736│ link = self._chooser.choose_for(operation.package)
737│
738│ if link.yanked:
RuntimeError
Unable to find installation candidates for torch (2.3.0)
at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/chooser.py:74 in choose_for
70│
71│ links.append(link)
72│
73│ if not links:
→ 74│ raise RuntimeError(f"Unable to find installation candidates for {package}")
75│
76│ # Get the best link
77│ chosen = max(links, key=lambda link: self._sort_key(package, link))
78│
Cannot install torch.