Skip to content

Installation fails with setuptools >=82 due to runtime import of pkg_resources #75

Description

@Tripton

Hi, thanks a lot for maintaining AlphaCLIP 🙂

We recently ran into an installation issue when AlphaCLIP is used as a dependency with modern Python packaging environments.

AlphaCLIP currently imports pkg_resources at runtime:

from pkg_resources import packaging

Unfortunately, `pkg_resources has been deprecated as an API for some time and has now been removed in setuptools 82.0.0 (2026-02-08 - https://setuptools.pypa.io/en/latest/history.html#v82-0-0).

As a result, installing projects that depend on AlphaCLIP fails with:

ModuleNotFoundError: No module named 'pkg_resources'

when using setuptools ≥82.

Maybe this could be fixed by replacing:

from pkg_resources import packaging

with:

from packaging.version import parse as parse_version

and update usages accordingly, e.g.:

if parse_version(torch.__version__) < parse_version("1.7.1"):

Also packaging should be added as an explicit dependency.

This removes the runtime dependency on setuptools internals and restores compatibility with modern setuptools versions.
Happy to open a PR if that helps 🙂

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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