What it means
Your code imports a module, and nothing on the server provides it. The server installs only what requirements.txt lists. The package is probably installed on your own computer, in your virtual environment or globally, and was never written into the file.
How to fix it
-
Find the package name
Ask your agent: "Which pip package provides this import?" It is often the same name, but not always.
-
Add it to
requirements.txtAdd the package name, and a version if you want to pin it. Commit the file.
-
Deploy again
A failed deploy never counts against your plan.
Import names that differ from package names
-
import cv2comes fromopencv-python. -
import PILcomes frompillow. -
import yamlcomes frompyyaml. -
import sklearncomes fromscikit-learn. -
import bs4comes frombeautifulsoup4. -
import dotenvcomes frompython-dotenv.
When the module is your own file
If the missing module is a file in your project, such as from app.utils import helper, check two things. The file must be committed and sent. The folder needs an __init__.py if your code needs one. Also check how the app is started: the folder it runs from decides what Python can import.