Add dependency of `setuptools`
- face_recognition version: 1.3.0
- Python version: 3.12.5
- Operating System: Windows 10
Description
Package face-recognition print message "Please install face_recognition_models with this command before using face_recognition" because setuptools is not installed.
What I Did
I installed setuptools package on my environment and works fine.
Submitted to face_recognition repo as PR 1617 ... I assume that's the right way to tackle this.
Another related problem: pkg_resources (used in face_recognition_models/__init__.py) is deprecated.
I did a clean install using the python:3.13-slim-trixie Docker image - executed docker run --rm -it python:3.13-slim-trixie bash, then, inside the container:
First, upgrade pip and install face_recognition_models:
root@e3052eb0a80a:/# pip install -U pip face_recognition_models
Requirement already satisfied: pip in /usr/local/lib/python3.13/site-packages (25.2)
Collecting pip
Downloading pip-25.3-py3-none-any.whl.metadata (4.7 kB)
Collecting face_recognition_models
Downloading face_recognition_models-0.3.0.tar.gz (100.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.1/100.1 MB 11.6 MB/s 0:00:08
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Downloading pip-25.3-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 10.5 MB/s 0:00:00
Building wheels for collected packages: face_recognition_models
Building wheel for face_recognition_models (pyproject.toml) ... done
Created wheel for face_recognition_models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566240 sha256=72ef577d94446c21e408af665d340c3c03fce7767568a974a5fc072590ec8abe
Stored in directory: /root/.cache/pip/wheels/39/20/47/6b647a3457f0e36c161b2516a5bd7f29f6bbd5e3a67c46a710
Successfully built face_recognition_models
Installing collected packages: face_recognition_models, pip
Attempting uninstall: pip
Found existing installation: pip 25.2
Uninstalling pip-25.2:
Successfully uninstalled pip-25.2
Successfully installed face_recognition_models-0.3.0 pip-25.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
Then, try to use it:
root@e3052eb0a80a:/# python
Python 3.13.9 (main, Nov 18 2025, 05:56:58) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import face_recognition_models
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import face_recognition_models
File "/usr/local/lib/python3.13/site-packages/face_recognition_models/__init__.py", line 7, in <module>
from pkg_resources import resource_filename
ModuleNotFoundError: No module named 'pkg_resources'
>>> exit()
Finally, install setuptools and use it again (the warning is shown):
root@e3052eb0a80a:/# pip install setuptools
Collecting setuptools
Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
Using cached setuptools-80.9.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptools
Successfully installed setuptools-80.9.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
root@e3052eb0a80a:/# python
Python 3.13.9 (main, Nov 18 2025, 05:56:58) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import face_recognition_models
/usr/local/lib/python3.13/site-packages/face_recognition_models/__init__.py:7: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import resource_filename
>>>
Maybe the best option would be to remove the dependency on setuptools and find another way to get the paths on __init__.py, like this (untested):
import sys
if sys.version_info >= (3, 9):
from importlib.resources import files
else:
from importlib_resources import files
def pose_predictor_model_location():
return str(files(__name__).joinpath("models/shape_predictor_68_face_landmarks.dat"))
def pose_predictor_five_point_model_location():
return str(files(__name__).joinpath("models/shape_predictor_5_face_landmarks.dat"))
def face_recognition_model_location():
return str(files(__name__).joinpath("models/dlib_face_recognition_resnet_model_v1.dat"))
def cnn_face_detector_model_location():
return str(files(__name__).joinpath("models/mmod_human_face_detector.dat"))