Skip to content

import packaging to be compatible with setuptools==70.0.0 #450

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JamieMartin
Copy link
Contributor

@JamieMartin JamieMartin commented Jun 3, 2024

As described in Issue #446, there is a change from setuptools 70.0.0 which causes breaking behaviour. This fix resolves this issue while maintaining backward compatibility for the import. Another option is to force usage of setuptools 70.0.0 which is provided in #449 .

File ~/python3.12/site-packages/clip/clip.py:6
      5 from typing import Any, Union, List
----> 6 from pkg_resources import packaging
      8 import torch

ImportError: cannot import name 'packaging' from 'pkg_resources' (~/python3.12/site-packages/pkg_resources/__init__.py)

clip/clip.py Outdated
raise ImportError(f"Failed to import 'packaging' module: {e}")

packaging = import_packaging()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution -- looks like the function was defined twice unintentionally, could you remove the second part here?

Copy link
Contributor Author

@JamieMartin JamieMartin Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch thanks. I've now removed the second part, which is duplicated.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants