poetry
poetry copied to clipboard
poetry selects wrong version for nightly PyTorch on OSX
- [x] I am on the latest Poetry version.
- [x] I have searched the issues of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: macOS Monterey 12.4
- Poetry version: 1.2.0b3
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/PaperclipBadger/59a1a7df41ce0af8725a694abf84ec0b
Issue
I'm trying to install the nightly build of PyTorch, so that I can use the new MPS acceleration.
Adding the PyTorch index as a source works (in 1.2.0b3, but not 1.1.14):
[[tool.poetry.source]]
name = "pytorch-nightly-cpu"
url = "https://download.pytorch.org/whl/nightly/cpu"
indexed = true
secondary = true
But poetry selects the 1.13.0.dev20220811+cpu
version, which does not have an build for OSX:
% poetry add --allow-prereleases --source pytorch-nightly-cpu torch -vvv
Loading configuration file /Users/PaperclipBadger/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/PaperclipBadger/Code/mypackage/poetry.toml
Adding repository pytorch-nightly-cpu (https://download.pytorch.org/whl/nightly/cpu) and setting it as secondary
Using virtualenv: /Users/PaperclipBadger/.pyenv/versions/3.10.5/envs/mypackage
Project environment contains an empty path in sys_path, ignoring.
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
Creating new session for download.pytorch.org
[urllib3.connectionpool] Starting new HTTPS connection (1): download.pytorch.org:443
[urllib3.connectionpool] https://download.pytorch.org:443 "GET /whl/nightly/cpu/torch/ HTTP/1.1" 200 146418
Source (pytorch-nightly-cpu): 120 packages found for torch *
Using version ^1.13.0.dev20220811+cpu for torch
Updating dependencies
Resolving dependencies...
1: fact: mypackage is 0.1.0
1: derived: mypackage
1: fact: mypackage depends on torch (^1.13.0.dev20220811+cpu)
1: selecting mypackage (0.1.0)
1: derived: torch (>=1.13.0.dev20220811+cpu,<2.0.0)
[urllib3.connectionpool] https://download.pytorch.org:443 "GET /whl/nightly/cpu/torch/ HTTP/1.1" 200 146418
Source (pytorch-nightly-cpu): 1 packages found for torch >=1.13.0.dev20220811+cpu,<2.0.0
[urllib3.connectionpool] https://download.pytorch.org:443 "GET /whl/nightly/cpu/torch/ HTTP/1.1" 200 146418
[urllib3.connectionpool] https://download.pytorch.org:443 "GET /whl/nightly/cpu/torch-1.13.0.dev20220811%2Bcpu-cp310-cp310-linux_x86_64.whl HTTP/1.1" 200 192738976
... (if left running, this will download every nightly cpu build without finding a match)
adding the dependency directly to pyproject.toml
also doesn't work but gives a different error:
torch = {version = "==1.13.0.dev20220811", allow-prereleases = true, source = "pytorch-nightly-cpu"}
% poetry install -vvv
Loading configuration file /Users/PaperclipBadger/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/PaperclipBadger/Code/mypackage/poetry.toml
Adding repository pytorch-nightly-cpu (https://download.pytorch.org/whl/nightly/cpu) and setting it as secondary
Using virtualenv: /Users/PaperclipBadger/.pyenv/versions/3.10.5/envs/mypackage
Project environment contains an empty path in sys_path, ignoring.
Installing dependencies from lock file
Finding the necessary packages for the current system
Package operations: 1 install, 0 updates, 0 removals, 1 skipped
• Installing torch (1.13.0.dev20220810+cpu)
• Installing typing-extensions (4.3.0): Skipped for the following reason: Already installed
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
Creating new session for download.pytorch.org
[urllib3.connectionpool] Starting new HTTPS connection (1): download.pytorch.org:443
[urllib3.connectionpool] https://download.pytorch.org:443 "GET /whl/nightly/cpu/torch/ HTTP/1.1" 200 146418
Skipping wheel torch-1.13.0.dev20220810+cpu-cp310-cp310-linux_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp310-cp310-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp311-cp311-linux_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp37-cp37m-linux_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp37-cp37m-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp38-cp38-linux_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp38-cp38-win_amd64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp39-cp39-linux_x86_64.whl as this is not supported by the current environment
Skipping wheel torch-1.13.0.dev20220810+cpu-cp39-cp39-win_amd64.whl as this is not supported by the current environment
Stack trace:
5 ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/executor.py:245 in _execute_operation
243│
244│ try:
→ 245│ result = self._do_execute_operation(operation)
246│ except EnvCommandError as e:
247│ if e.e.returncode == -2:
4 ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/executor.py:317 in _do_execute_operation
315│ return 0
316│
→ 317│ result: int = getattr(self, f"_execute_{method}")(operation)
318│
319│ if result != 0:
3 ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/executor.py:437 in _execute_install
435│
436│ def _execute_install(self, operation: Install | Update) -> int:
→ 437│ status_code = self._install(operation)
438│
439│ self._save_url_reference(operation)
2 ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/executor.py:472 in _install
470│ archive = self._download_link(operation, Link(package.source_url))
471│ else:
→ 472│ archive = self._download(operation)
473│
474│ operation_message = self.get_operation_message(operation)
1 ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/executor.py:609 in _download
607│
608│ def _download(self, operation: Install | Update) -> Path:
→ 609│ link = self._chooser.choose_for(operation.package)
610│
611│ return self._download_link(operation, link)
RuntimeError
Unable to find installation candidates for torch (1.13.0.dev20220810+cpu)
at ~/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages/poetry/installation/chooser.py:103 in choose_for
99│
100│ links.append(link)
101│
102│ if not links:
→ 103│ raise RuntimeError(f"Unable to find installation candidates for {package}")
104│
105│ # Get the best link
106│ chosen = max(links, key=lambda link: self._sort_key(package, link))
107│
Looking at the PyTorch index, we see that indeed there are no builds tagged +cpu for OSX - the OSX builds do not have a local version specifier: https://download.pytorch.org/whl/nightly/torch/
torch-1.13.0.dev20220811+cpu-cp310-cp310-linux_x86_64.whl
torch-1.13.0.dev20220811+cpu-cp310-cp310-win_amd64.whl
torch-1.13.0.dev20220811+cpu-cp311-cp311-linux_x86_64.whl
torch-1.13.0.dev20220811+cpu-cp37-cp37m-linux_x86_64.whl
torch-1.13.0.dev20220811+cpu-cp37-cp37m-win_amd64.whl
torch-1.13.0.dev20220811+cpu-cp38-cp38-linux_x86_64.whl
torch-1.13.0.dev20220811+cpu-cp38-cp38-win_amd64.whl
torch-1.13.0.dev20220811+cpu-cp39-cp39-linux_x86_64.whl
torch-1.13.0.dev20220811+cpu-cp39-cp39-win_amd64.whl
torch-1.13.0.dev20220811-cp310-none-macosx_10_9_x86_64.whl
torch-1.13.0.dev20220811-cp310-none-macosx_11_0_arm64.whl
torch-1.13.0.dev20220811-cp37-none-macosx_10_9_x86_64.whl
torch-1.13.0.dev20220811-cp37-none-macosx_11_0_arm64.whl
torch-1.13.0.dev20220811-cp38-none-macosx_10_9_x86_64.whl
torch-1.13.0.dev20220811-cp38-none-macosx_11_0_arm64.whl
torch-1.13.0.dev20220811-cp39-none-macosx_10_9_x86_64.whl
torch-1.13.0.dev20220811-cp39-none-macosx_11_0_arm64.whl
poetry should select 1.13.0.dev20220811
, not 1.13.0.dev20220811+cpu
. This is what pip does:
% pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/nightly/cpu
Collecting torch
Using cached https://download.pytorch.org/whl/nightly/cpu/torch-1.13.0.dev20220811-cp310-none-macosx_11_0_arm64.whl (50.6 MB)
Requirement already satisfied: typing-extensions in /Users/PaperclipBadger/.pyenv/versions/3.10.5/envs/mypackage/lib/python3.10/site-packages (from torch) (4.3.0)
Installing collected packages: torch
Successfully installed torch-1.13.0.dev20220811