Skip to content

Unable to find candidates for torch #10125

@olsihoxha

Description

@olsihoxha

Description

So I am trying to install torch on one of my projects and my specs are as below

Python 3.12.3 / pip latest / Poetry (version 2.0.1)/ I am on Apple M3 Max

Here is my pyproject.toml

torch = { version = "^2.5.1+cpu", source = "pytorch-cpu" }
torchvision = { version = "^0.20.1+cpu", source = "pytorch-cpu" }
torchaudio = { version = "^2.5.1+cpu", source = "pytorch-cpu" }

[[tool.poetry.source]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
priority = "explicit"

Adding a screenshot for more context

Image

When I create a new project I am able to install with pip torch up to 2.6.0(which is latest)

below will be my full dependency list just in case

[tool.poetry.dependencies]
python = "~3.12.3"
fastapi = "^0.111.0"
uvicorn = "^0.30.1"
loguru = "^0.7.2"
sqlalchemy = "^2.0.30"
boto3 = "^1.34.122"
asyncpg = "^0.29.0"
greenlet = "^3.0.3"
python-dotenv = "^1.0.1"
jwcrypto = "^1.5.6"
jinja2 = "^3.1.4"
mangum = "^0.17.0"
requests = "^2.32.3"
deepgram-sdk = "^3.2.7"
langchain-openai = "^0.3.1"
langchain-google-genai = "^2.0.9"
langchain-mistralai = "^0.2.4"
langchain-anthropic = "^0.3.3"
google-auth-oauthlib = "^1.2.0"
fuzzywuzzy = "^0.18.0"
levenshtein = "^0.25.1"
msgraph-sdk = "^1.4.0"
twilio = "^9.1.1"
alembic = "^1.13.1"
python-multipart = "^0.0.9"
langchain = "^0.3.15"
langgraph = "^0.2.66"
pytz = "^2024.1"
bcrypt = "^4.1.3"
langchain-core = "^0.3.31"
langchain-text-splitters = "^0.3.5"
langsmith = "^0.3.1"
langchain-community = "^0.3.15"
langchain-cohere = "^0.4.1"
# langchain-google-vertexai = "^1.0.5"
langchain-postgres = "^0.0.12"
s3fs = "^2024.6.1"
azure-storage-blob = "^12.20.0"
sqlparse = "^0.5.0"
pymupdf = "^1.24.7"
ultralytics = "^8.2.60"
opencv-python-headless = "^4.10.0.84"
llm-sdk = "^0.3.2"
sentry-sdk = { extras = ["fastapi"], version = "^2.13.0" }
nltk = "^3.9.1"
unstructured = { extras = ["all-docs"], version = "^0.16.11" }
unstructured-ingest = { extras = ["gcs"], version = "^0.1.1" }
matplotlib = "^3.9.2"
python-magic = "^0.4.27"
pytesseract = "^0.3.13"
psycopg = { extras = ["binary"], version = "^3.2.2" }
pydantic = "2.10.5"
torch = { version = "^2.5.1+cpu", source = "pytorch-cpu" }
torchvision = { version = "^0.20.1+cpu", source = "pytorch-cpu" }
torchaudio = { version = "^2.5.1+cpu", source = "pytorch-cpu" }

[[tool.poetry.source]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
priority = "explicit"

[build-system]
requires = ["poetry-core"]

build-backend = "poetry.core.masonry.api"

Workarounds

No idea

Poetry Installation Method

pipx

Operating System

MacOS 15.2

Poetry Version

2.0.1

Poetry Configuration

cache-dir = "/Users/userName/Library/Caches/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
repositories.pytorch-cpu.url = "https://download.pytorch.org/whl/cpu"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/UserName/Library/Caches/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

Poetry Runtime Logs

poetry-runtime.log
- Installing torch (2.5.1+cpu): Failed

RuntimeError

Unable to find installation candidates for torch (2.5.1+cpu)

at ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/chooser.py:86 in choose_for
     82│ 
     83│             links.append(link)
     84│ 
     85│         if not links:
  →  86│             raise RuntimeError(f"Unable to find installation candidates for {package}")
     87│ 
     88│         # Get the best link
     89│         chosen = max(links, key=lambda link: self._sort_key(package, link))
     90│ 

Cannot install torch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions