[GH-ISSUE #528] Build fails with setuptools 81+ due to pkg_resources removal #439

Open
opened 2026-10-31 21:14:58 +00:00 by bsakaguchi · 12 comments
Owner

Originally created by @mabunassar on GitHub (Feb 9, 2026).
Original GitHub issue: https://github.com/openai/CLIP/issues/528

Description

Problem

CLIP fails to build with setuptools 82+ because setup.py imports pkg_resources, which was removed in setuptools 81 (08 Feb 2026).

ModuleNotFoundError: No module named 'pkg_resources'

The failing line in setup.py:

from pkg_resources import packaging

Suggested fix

Replace pkg_resources.packaging with packaging from the standalone packaging library:

  # Before
  from pkg_resources import packaging

  # After
  import packaging.version

And add packaging to the build dependencies in setup.py or migrate to a pyproject.toml build system.

Workaround

Pin setuptools to <81 and disable build isolation for CLIP.

Environment

  - Python 3.11
  - setuptools 82+
  - uv / pip
Originally created by @mabunassar on GitHub (Feb 9, 2026). Original GitHub issue: https://github.com/openai/CLIP/issues/528 ## Description ### Problem CLIP fails to build with setuptools 82+ because `setup.py` imports `pkg_resources`, which was removed in setuptools 81 (08 Feb 2026). ``` ModuleNotFoundError: No module named 'pkg_resources' ``` The failing line in `setup.py`: ```python from pkg_resources import packaging ``` ### Suggested fix Replace pkg_resources.packaging with packaging from the standalone packaging library: ``` # Before from pkg_resources import packaging # After import packaging.version ``` And add packaging to the build dependencies in setup.py or migrate to a pyproject.toml build system. ### Workaround Pin setuptools to <81 and disable build isolation for CLIP. ### Environment ``` - Python 3.11 - setuptools 82+ - uv / pip ```
Author
Owner

@dshepelev15 commented on GitHub (Feb 9, 2026):

Have the same issue

<!-- gh-comment-id:3874438517 --> @dshepelev15 commented on GitHub (Feb 9, 2026): Have the same issue
Author
Owner

@amartinpascual commented on GitHub (Feb 10, 2026):

Same issue here

<!-- gh-comment-id:3875987950 --> @amartinpascual commented on GitHub (Feb 10, 2026): Same issue here
Author
Owner

@Saladino commented on GitHub (Feb 10, 2026):

Same issue here

<!-- gh-comment-id:3876743354 --> @Saladino commented on GitHub (Feb 10, 2026): Same issue here
Author
Owner

@yakulex commented on GitHub (Feb 10, 2026):

Same issue, worked after downgrading setuptools to 80 and pip to 25

<!-- gh-comment-id:3877166179 --> @yakulex commented on GitHub (Feb 10, 2026): Same issue, worked after downgrading setuptools to 80 and pip to 25
Author
Owner

@z-jiaming commented on GitHub (Feb 10, 2026):

Fix by

pip install "setuptools>=65.0.0,<81"
pip install "pip==25.0"
<!-- gh-comment-id:3878775592 --> @z-jiaming commented on GitHub (Feb 10, 2026): Fix by ``` pip install "setuptools>=65.0.0,<81" pip install "pip==25.0" ```
Author
Owner

@ArmadstheDoom commented on GitHub (Feb 10, 2026):

Fix by

pip install "setuptools>=65.0.0,<81"
pip install "pip==25.0"

This is wrong. Namely because it doesn't work, and it will just say that it's already installed.

<!-- gh-comment-id:3879561576 --> @ArmadstheDoom commented on GitHub (Feb 10, 2026): > Fix by > > ``` > pip install "setuptools>=65.0.0,<81" > pip install "pip==25.0" > ``` This is wrong. Namely because it doesn't work, and it will just say that it's already installed.
Author
Owner

@ArmadstheDoom commented on GitHub (Feb 10, 2026):

Same issue, worked after downgrading setuptools to 80 and pip to 25

would you mind explaining how you did that?

<!-- gh-comment-id:3879600274 --> @ArmadstheDoom commented on GitHub (Feb 10, 2026): > Same issue, worked after downgrading setuptools to 80 and pip to 25 would you mind explaining how you did that?
Author
Owner

@z-jiaming commented on GitHub (Feb 10, 2026):

Fix by

pip install "setuptools>=65.0.0,<81"
pip install "pip==25.0"

This is wrong. Namely because it doesn't work, and it will just say that it's already installed.

But I fixed it right now.

<!-- gh-comment-id:3879683229 --> @z-jiaming commented on GitHub (Feb 10, 2026): > > Fix by > > ``` > > pip install "setuptools>=65.0.0,<81" > > pip install "pip==25.0" > > ``` > > This is wrong. Namely because it doesn't work, and it will just say that it's already installed. But I fixed it right now.
Author
Owner

@ArmadstheDoom commented on GitHub (Feb 10, 2026):

Fix by

pip install "setuptools>=65.0.0,<81"
pip install "pip==25.0"

This is wrong. Namely because it doesn't work, and it will just say that it's already installed.

But I fixed it right now.

Great, still doesn't work.

<!-- gh-comment-id:3879767652 --> @ArmadstheDoom commented on GitHub (Feb 10, 2026): > > > Fix by > > > ``` > > > pip install "setuptools>=65.0.0,<81" > > > pip install "pip==25.0" > > > ``` > > > > > > This is wrong. Namely because it doesn't work, and it will just say that it's already installed. > > But I fixed it right now. Great, still doesn't work.
Author
Owner

@yakulex commented on GitHub (Feb 11, 2026):

This is wrong. Namely because it doesn't work, and it will just say that it's already installed.

Try this

pip install --force-reinstall pip==25.2 setuptools==80.10.2
<!-- gh-comment-id:3883313712 --> @yakulex commented on GitHub (Feb 11, 2026): > This is wrong. Namely because it doesn't work, and it will just say that it's already installed. Try this ```bash pip install --force-reinstall pip==25.2 setuptools==80.10.2 ```
Author
Owner

@Iionccub365 commented on GitHub (Feb 11, 2026):

This is wrong. Namely because it doesn't work, and it will just say that it's already installed.

Try this

pip install --force-reinstall pip==25.2 setuptools==80.10.2

This worked for me! Setuptools<81 and pip<25.3 appears to be the solution. pip 25.3 deprecates the legacy setup and setuptools 81 removes pkg_resources

<!-- gh-comment-id:3884053956 --> @Iionccub365 commented on GitHub (Feb 11, 2026): > > This is wrong. Namely because it doesn't work, and it will just say that it's already installed. > > Try this > > pip install --force-reinstall pip==25.2 setuptools==80.10.2 This worked for me! Setuptools<81 and pip<25.3 appears to be the solution. pip 25.3 deprecates the legacy setup and setuptools 81 removes pkg_resources
Author
Owner

@codehia commented on GitHub (Feb 11, 2026):

With setuptools==80.10.2, pip install <> --no-build-isolation worked for me without changing the pip version.

<!-- gh-comment-id:3884279862 --> @codehia commented on GitHub (Feb 11, 2026): With `setuptools==80.10.2`, `pip install <> --no-build-isolation` worked for me without changing the pip version.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#439
No description provided.