Skip to content

Fail to install pytorch (cpu) on MacOS intel chip #8358

@fzyzcjy

Description

@fzyzcjy

Hi thanks for the tool! However I cannot do it and here are my attempts:

version

uv --version
uv 0.4.24 (b9cd54913 2024-10-17)

setup

(base) ➜  temp uv init hello_uv
Initialized project `hello-uv` at `/Users/tom/temp/hello_uv`
(base) ➜  temp cd hello_uv 
(base) ➜  hello_uv git:(main) ✗ ls
README.md      hello.py       pyproject.toml

attempt 1

(base) ➜  hello_uv git:(main) ✗ uv add torch
Using CPython 3.9.12 interpreter at: /Users/tom/opt/anaconda3/bin/python
Creating virtual environment at: .venv
Resolved 24 packages in 44.33s
error: Distribution `torch==2.5.0 @ registry+https://pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform

attempt 2

(base) ➜  hello_uv git:(main) ✗ uv add torch --extra-index-url=https://download.pytorch.org/whl/cpu 
warning: Indexes specified via `--extra-index-url` will not be persisted to the `pyproject.toml` file; use `--index` instead.
Resolved 23 packages in 11.67s
error: Distribution `torch==2.5.0 @ registry+https://download.pytorch.org/whl/cpu` can't be installed because it doesn't have a source distribution or wheel for the current platform

attempt 3

(base) ➜  hello_uv git:(main) ✗ uv add torch --index-url=https://download.pytorch.org/whl/cpu      
warning: Indexes specified via `--index-url` will not be persisted to the `pyproject.toml` file; use `--default-index` instead.
Resolved 11 packages in 9.48s
error: Distribution `torch==2.5.0+cpu @ registry+https://download.pytorch.org/whl/cpu` can't be installed because it doesn't have a source distribution or wheel for the current platform

attempt 4

[project]
name = "project"
version = "0.1.0"
dependencies = [
  "torch==2.1.2 ; platform_system != 'Windows'",
]
(base) ➜  hello_uv git:(main) ✗ uv sync            
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.11`.
  × No solution found when resolving dependencies for split (platform_system == 'Windows'):
  ╰─▶ Because there is no version of torch{platform_system == 'Windows'}==2.1.2+cu121 and your project depends on
      torch{platform_system == 'Windows'}==2.1.2+cu121, we can conclude that your project's requirements are unsatisfiable.

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