pypa/pip · error · PylockSelectError

No wheel found matching the provided tags for package {packa

Error message

No wheel found matching the provided tags for package {package.name!r} at packages[{package_index}], and no sdist available as a fallback

What it means

Raised as PylockSelectError (pylock.py:891) by Pylock.select() when a package that has wheels yields no wheel compatible with the provided/derived tags (create_compatible_tags_selector returns nothing) AND the package has no sdist to fall back to. It is the final 'no source available' guard in the install-source selection ladder.

Source

Thrown at src/pip/_vendor/packaging/pylock.py:891

            # - Else if there are entries for :ref:`pylock-packages-wheels`:
            elif package.wheels:
                # #. Look for the appropriate wheel file based on
                #    :ref:`pylock-packages-wheels-name`; if one is not found then move
                #    on to :ref:`pylock-packages-sdist` or an error MUST be raised about
                #    a lack of source for the project.
                best_wheel = next(
                    compatible_tags_selector(
                        (wheel, parse_wheel_filename(wheel.filename)[-1])
                        for wheel in package.wheels
                    ),
                    None,
                )
                if best_wheel:
                    yield package, best_wheel
                elif package.sdist is not None:
                    yield package, package.sdist
                else:
                    raise PylockSelectError(
                        f"No wheel found matching the provided tags "
                        f"for package {package.name!r} "
                        f"at packages[{package_index}], "
                        f"and no sdist available as a fallback"
                    )

            # - Else if no :ref:`pylock-packages-wheels` file is found or
            #   :ref:`pylock-packages-sdist` is solely set:
            elif package.sdist is not None:
                yield package, package.sdist

            else:
                # Covered by lock.validate() which is a precondition for this method.
                raise NotImplementedError  # pragma: no cover

View on GitHub (pinned to d7d0d0a394)

Solutions

  1. Add an sdist entry to the package so selection can fall back to building from source.
  2. Add a wheel matching your platform/ABI/interpreter to the wheels list.
  3. Pass tags= that match one of the existing wheels, or run on a supported platform.

Example fix

# before: only Windows wheels, no sdist, installing on Linux
[[packages]]
name = "foo"
wheels = [{ filename = "foo-1.0-cp312-cp312-win_amd64.whl", url = "..." }]

# after: add an sdist fallback
[[packages]]
name = "foo"
wheels = [{ filename = "foo-1.0-cp312-cp312-win_amd64.whl", url = "..." }]
[packages.sdist]
filename = "foo-1.0.tar.gz"
Defensive patterns

Strategy: validation

Validate before calling

from pip._vendor.packaging.tags import create_compatible_tags_selector, sys_tags
from pip._vendor.packaging.utils import parse_wheel_filename
def package_installable_for_tags(package, tags=None):
    selector = create_compatible_tags_selector(tags or sys_tags())
    if package.get('wheels'):
        hit = selector((w, parse_wheel_filename(w['filename'])[-1]) for w in package['wheels'])
        return hit is not None or bool(package.get('sdist'))
    return True

Type guard

null

Try / catch

from pip._vendor.packaging.pylock import PylockSelectError
try:
    list(pylock.select(tags=my_tags))
except PylockSelectError as e:
    if 'No wheel found' in str(e):
        add_sdist_or_matching_wheel(e)

Prevention

When it happens

Trigger: select(tags=my_tags) on a package whose wheels are all for other platforms/ABIs (e.g. only cp312-win_amd64 wheels, selecting on linux) and whose sdist is unset. Also fires with default sys_tags() when the host has no matching wheel and no sdist exists.

Common situations: Platform-specific project (e.g. binary-only) installed on an unsupported platform. A lock that dropped the sdist entry to save space. tags mismatch caused by a non-standard interpreter (PyPy, GraalPy) with no matching wheels.

Related errors


AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04). Data as JSON: /data/errors/cc6101bd3fb4d054.json. Report an issue: GitHub.