Skip to content

Install problem due to typing_extensions inconsistency (Solution Included) #12

@Sana-A-E

Description

@Sana-A-E

There is a problem installing the VisionCaptioner on Windows. It is hitting a frustrating "case-sensitivity" bug in pip's dependency resolver. The PyTorch index is serving metadata for typing_extensions (with an underscore), but torch is asking for typing-extensions (with a hyphen). While these are technically the same package, pip sometimes chokes on the naming mismatch when using custom --index-url flags.
As a result, the install of torchvision fails with an error

Collecting typing-extensions>=4.10.0
  Obtaining dependency information for typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.15.0-py3-none-any.whl.metadata
  Using cached https://download.pytorch.org/whl/typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
Discarding https://download.pytorch.org/whl/typing_extensions-4.15.0-py3-none-any.whl (from https://download.pytorch.org/whl/cu130/typing-extensions/): Requested typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.15.0-py3-none-any.whl (from torch) has inconsistent Name: expected 'typing-extensions', but metadata has 'typing_extensions'
  Obtaining dependency information for typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.14.0-py3-none-any.whl.metadata
  Using cached https://download.pytorch.org/whl/typing_extensions-4.14.0-py3-none-any.whl.metadata (3.0 kB)
Discarding https://download.pytorch.org/whl/typing_extensions-4.14.0-py3-none-any.whl (from https://download.pytorch.org/whl/cu130/typing-extensions/): Requested typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.14.0-py3-none-any.whl (from torch) has inconsistent Name: expected 'typing-extensions', but metadata has 'typing_extensions'
  Obtaining dependency information for typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl.metadata
  Using cached https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Discarding https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl (from https://download.pytorch.org/whl/cu130/typing-extensions/): Requested typing-extensions>=4.10.0 from https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl (from torch) has inconsistent Name: expected 'typing-extensions', but metadata has 'typing_extensions'
Collecting torch
  Obtaining dependency information for torch from https://download-r2.pytorch.org/whl/cu130/torch-2.10.0%2Bcu130-cp310-cp310-win_amd64.whl.metadata
  Downloading https://download-r2.pytorch.org/whl/cu130/torch-2.10.0%2Bcu130-cp310-cp310-win_amd64.whl.metadata (29 kB)
  Obtaining dependency information for torch from https://download-r2.pytorch.org/whl/cu130/torch-2.9.1%2Bcu130-cp310-cp310-win_amd64.whl.metadata
  Downloading https://download-r2.pytorch.org/whl/cu130/torch-2.9.1%2Bcu130-cp310-cp310-win_amd64.whl.metadata (29 kB)
  Obtaining dependency information for torch from https://download-r2.pytorch.org/whl/cu130/torch-2.9.0%2Bcu130-cp310-cp310-win_amd64.whl.metadata
  Downloading https://download-r2.pytorch.org/whl/cu130/torch-2.9.0%2Bcu130-cp310-cp310-win_amd64.whl.metadata (29 kB)
ERROR: Cannot install torch==2.10.0+cu130, torch==2.11.0+cu130, torch==2.9.0+cu130 and torch==2.9.1+cu130 because these package versions have conflicting dependencies.

The conflict is caused by:
    torch 2.11.0+cu130 depends on typing-extensions>=4.10.0
    torch 2.10.0+cu130 depends on typing-extensions>=4.10.0
    torch 2.9.1+cu130 depends on typing-extensions>=4.10.0
    torch 2.9.0+cu130 depends on typing-extensions>=4.10.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: Resolution Impossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

There are several solutions to this, take your pick:

1. Install the dependency first

Force-install the problematic dependency from the standard Python repository (PyPI) before trying the PyTorch command again. This bypasses the naming conflict in the metadata.
If you chose this method, the following line needs to be executed before pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130 when installing VisionCaptioner:

pip install typing-extensions jinja2

2. The "Extra Index" Method

Instead of overriding the entire index, tell pip to use the PyTorch URL as an extra source. This allows it to grab the heavy GPU wheels from PyTorch but fetch standard dependencies (like jinja2 and typing-extensions) from the main PyPI repository where the names are consistent.

pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu130

3. Update Pip

This specific metadata handling issue was improved in later versions. Add pip upgrade instructions to the install instructions before attempting to install pytorch.

python -m pip install --upgrade pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions