Update face-recognition dependency pins to match the refreshed tutorial - #809
Open
realpython-bot wants to merge 1 commit into
Open
Update face-recognition dependency pins to match the refreshed tutorial#809realpython-bot wants to merge 1 commit into
realpython-bot wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tutorial Build Your Own Face Recognition Tool With Python was refreshed in the CMS this week. Its
requirements.txtblock now pins current releases, but all sevenrequirements.txtfiles in this folder still carried the 2023-era pins — so anyone downloading the materials built a different environment than the article describes.What changed
Applied identically to
source_code_final/andsource_code_step_1/throughsource_code_step_6/. The pin list now mirrors the article'srequirements.txtblock exactly.Why the setuptools pin matters
This is the load-bearing change.
face_recognition_modelsdoesfrom pkg_resources import resource_filenameat import time, and setuptools removedpkg_resourcesin 82.0.0.Verified empirically in a clean Python 3.13.14 venv with these exact pins installed:
import face_recognitionPlease install face_recognition_models with this command before using face_recognition81.0.0 is the highest release below 82.0.0. Note that 81.0.0 does emit a
UserWarningon 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 installof 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 --helpruns;--train -m hogcompletes in 40s over the bundled training set and writesoutput/encodings.pkl(109 encodings across 7 people).unknown.jpgyields 2 face locations, one correctly matched tojerry_seinfeld.numpy==2.5.2declaresrequires_python >=3.12, consistent with the article's "built on Python 3.13, also tested on 3.12 and 3.14".--validateand--testproduce no console output becausedetector.pydisplays results throughPIL.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.pyis untouched.Prepared during a written-content maintenance review (reviewer: Martin Breuss).
🤖 Generated with Claude Code