Skip to content

Replace deprecated pkg_resources with importlib.resources#25

Open
Chowdhury-Anik wants to merge 2 commits into
ageitgey:masterfrom
Chowdhury-Anik:Chowdhury-Anik-patch-1
Open

Replace deprecated pkg_resources with importlib.resources#25
Chowdhury-Anik wants to merge 2 commits into
ageitgey:masterfrom
Chowdhury-Anik:Chowdhury-Anik-patch-1

Conversation

@Chowdhury-Anik

Copy link
Copy Markdown

This fixes the deprecation warning by migrating from pkg_resources to importlib.resources.

Changes:

  • Replaced 'from pkg_resources import resource_filename' with 'from importlib.resources import files'
  • Updated all resource_filename(name, path) calls to str(files(name).joinpath(path))

This ensures compatibility with Python 3.7+ and Setuptools >= 81.0.0.

Fixes ageitgey/face_recognition#1645

This fixes the deprecation warning by migrating from pkg_resources to importlib.resources.

Changes:
- Replaced 'from pkg_resources import resource_filename' with 'from importlib.resources import files'
- Updated all resource_filename(__name__, path) calls to str(files(__name__).joinpath(path))

This ensures compatibility with Python 3.7+ and Setuptools >= 81.0.0.

Fixes ageitgey/face_recognition#1645

@turicas turicas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR correctly fixes #21.

Comment thread face_recognition_models/__init__.py Outdated
add the missing ' )' in str(files(__name__).joinpath(...))
@hardik-rajpal

Copy link
Copy Markdown

Let's merge this please?

@JayBigGuy10

Copy link
Copy Markdown

god please can this be merged, i burnt like a whole day recreating my venv's / recompiling face_recognition on a slow raspberry pi before i figured out that it was an issue with this

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeprecationWarning: pkg_resources is deprecated - Migration to importlib.resources needed

5 participants