Read the missing name in the traceback
A ModuleNotFoundError means the interpreter starting your app cannot find the named module on its search path. If it is a third-party package, check that the deployment installed the matching distribution. If it is a module you wrote, make sure its source files reached the host. Look at the exact name in the last line of the traceback before adding dependencies.
For example, from PIL import Image imports the Python package named PIL, which ships in the Pillow distribution. A project that resizes thumbnails would put Pillow in requirements.txt. A missing mybot.handlers, on the other hand, may be a package inside your own repository. Check its directory and spelling in Files.
Prove your dependency list in a fresh environment
On your development machine, create a clean virtual environment using the Python version you plan to host. From your project root, use that environment’s interpreter for both installation and the import test. Here are the commands for a POSIX shell, using the thumbnail example. pip’s installation and requirements guide.
python -m venv .venv-check
.venv-check/bin/python -m pip install -r requirements.txt
.venv-check/bin/python -c "from PIL import Image; print(Image.__name__)"A successful import prints PIL.Image. An installation error earlier in the output may name a package version that does not support that interpreter. A package with compiled extensions may also require a compatible build for the host operating system.
Match your hosted command to the successful test
Upload your code and the verified requirements.txt. Leave the local virtual environment out of the upload. Check the deployment root for an extra enclosing directory. On the standard Python profile, set MAIN_FILE to the actual entry file. If you set a custom RUN_COMMAND, include installation and start the app with the same interpreter. Restart, read Console from the install step and exercise the feature that imports the package. Deploying your own Python project.