# ModuleNotFoundError: No module named 'requests' How to fix it.

URL: https://antideploy.com/blog/modulenotfounderror-no-module-named

Your code imports a Python package that is not listed in requirements.txt. Add it, and use the package name, which can differ from the import name.

**What you see**

```
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
```

## At a glance

- **What it means**: An import has no installed package
- **The fix**: Add the package to requirements.txt
- **Watch out**: Import names differ from package names
- **Or**: A local file was not sent

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## 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

### 1. Find the package name

Ask your agent: "Which pip package provides this import?" It is often the same name, but not always.

### 2. Add it to requirements.txt

Add the package name, and a version if you want to pin it. Commit the file.

### 3. Deploy again

A failed deploy never counts against your plan.

## Import names that differ from package names

- **`import cv2`** comes from `opencv-python`.
- **`import PIL`** comes from `pillow`.
- **`import yaml`** comes from `pyyaml`.
- **`import sklearn`** comes from `scikit-learn`.
- **`import bs4`** comes from `beautifulsoup4`.
- **`import dotenv`** comes from `python-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.

## Python import questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### Why does it work on my machine?

Your machine has packages installed that the project never listed. A clean server has only what `requirements.txt` says.

### How do I list everything I use?

Ask your agent to compare your imports with `requirements.txt`, or run `pip freeze` in your working environment and keep the packages your code uses.

### Does this failed deploy cost anything?

No. Failed deploys never count against your plan.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [ERROR: Could not find a version that satisfies the requirement](https://antideploy.com/blog/could-not-find-a-version-that-satisfies-the-requirement): No version matches your requirements.txt, often because of the Python version. Pin Python or loosen the pin.
- [ERROR: Failed building wheel for psycopg2](https://antideploy.com/blog/failed-building-wheel): A package had to be compiled and the compile failed. Use a prebuilt version, or pin Python to 3.12.
- [How to deploy a Flask app for free](https://antideploy.com/blog/how-to-deploy-a-flask-app-for-free): How your app is found, why to add gunicorn, the PORT variable and Postgres.

- [Deployments](https://antideploy.com/platform/deployments)
- [Logs and monitoring](https://antideploy.com/platform/logs-and-monitoring)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
