Skip to content

Update face-recognition dependency pins to match the refreshed tutorial - #809

Open
realpython-bot wants to merge 1 commit into
realpython:masterfrom
realpython-bot:face-recognition-dependency-refresh
Open

Update face-recognition dependency pins to match the refreshed tutorial#809
realpython-bot wants to merge 1 commit into
realpython:masterfrom
realpython-bot:face-recognition-dependency-refresh

Conversation

@realpython-bot

@realpython-bot realpython-bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

The tutorial Build Your Own Face Recognition Tool With Python was refreshed in the CMS this week. Its requirements.txt block now pins current releases, but all seven requirements.txt files in this folder still carried the 2023-era pins — so anyone downloading the materials built a different environment than the article describes.

What changed

package was now
dlib 19.24.0 20.0.1
numpy 1.24.2 2.5.2
Pillow 9.4.0 12.3.0
setuptools absent 81.0.0
face-recognition 1.3.0 1.3.0 (unchanged — still its latest release, 2020-02-20)

Applied identically to source_code_final/ and source_code_step_1/ through source_code_step_6/. The pin list now mirrors the article's requirements.txt block exactly.

Why the setuptools pin matters

This is the load-bearing change. face_recognition_models does from pkg_resources import resource_filename at import time, and setuptools removed pkg_resources in 82.0.0.

Verified empirically in a clean Python 3.13.14 venv with these exact pins installed:

setuptools import face_recognition
80.9.0 OK
81.0.0 OK
82.0.0 failsPlease install face_recognition_models with this command before using face_recognition

81.0.0 is the highest release below 82.0.0. Note that 81.0.0 does emit a UserWarning on import (pkg_resources is deprecated as an API ... pin to Setuptools<81); 80.9.0 emits the same warning, so dropping a version further back buys nothing. The warning is cosmetic — the import succeeds and the tool runs.

Verification

Full end-to-end run, not just a resolver check:

  • pip install of all five pins into a clean Python 3.13.14 venv — dlib 20.0.1 built from source against gcc 13.3.0 / CMake 3.28.3 (~10 min, no wheel for this pin/platform).
  • detector.py --help runs; --train -m hog completes in 40s over the bundled training set and writes output/encodings.pkl (109 encodings across 7 people).
  • Recognition confirmed functionally: unknown.jpg yields 2 face locations, one correctly matched to jerry_seinfeld.
  • Every pin confirmed as the current PyPI release; numpy==2.5.2 declares requires_python >=3.12, consistent with the article's "built on Python 3.13, also tested on 3.12 and 3.14".

--validate and --test produce no console output because detector.py displays results through PIL.Image.show(), which is a no-op in a headless environment — that is pre-existing behaviour, unrelated to this change.

No Python source files changed — the content audit raised no code-failure or output-drift issues for this article, so detector.py is untouched.

Prepared during a written-content maintenance review (reviewer: Martin Breuss).

🤖 Generated with Claude Code

The tutorial "Build Your Own Face Recognition Tool With Python" was
refreshed in the CMS and its requirements.txt block now pins current
releases. These seven files still carried the 2023-era pins, so anyone
downloading the materials built a different environment than the article
describes.

  dlib       19.24.0 -> 20.0.1
  numpy      1.24.2  -> 2.5.2
  Pillow     9.4.0   -> 12.3.0
  setuptools (absent) -> 81.0.0

face-recognition stays at 1.3.0, its latest release (2020-02-20).

The setuptools pin is the load-bearing one. face_recognition_models does
`from pkg_resources import resource_filename` at import time, and
setuptools removed pkg_resources in 82.0.0 -- the 81.0.0 wheel ships 19
files under pkg_resources/, the 82.0.0 wheel ships none. Without the pin,
`import face_recognition` aborts with "Please install face_recognition_models".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant