pipreqs not capturing all imports
Author: srishti0190Created Jun 14, 2018Updated Jun 3, 2026
Labelsmapping
In my code I wanted to create a requirements.txt file with all the dependencies needed to run my model. I used pip freeze earlier, however, because of obvious reasons i.e. it captures everything from the environment and not just the ones needed for my model, I moved to pipreqs.
I tested it with a very basic .py file with some imports, out of those the following is not getting captured correctly:
import cv2
The problem I faces is: It fails to capture opencv-python for cv2.
Below error is thrown: DEBUG: Starting new HTTPS connection (1): pypi.org DEBUG: https://pypi.org:443 "GET /cv2/json HTTP/1.1" 404 1443 DEBUG: Package cv2 does not exist or network problems
Can anyone help here.
Source: bndr/pipreqs