ModuleNotFoundError: No module named 'requests' (tested fix)

ModuleNotFoundError: No module named 'requests' means the Python running your code has no copy of requests. Usually it was installed, but into a different Python. We reproduced both cases in a clean container and tested the fix.

1. Cause: requests is not installed for the Python that runs your script

python -m venv /tmp/venv
/tmp/venv/bin/python -c "import requests"

Output (sh -x, so each command is echoed with a +):

+ python -m venv /tmp/venv
+ /tmp/venv/bin/python -c 'import requests'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

requests is a third-party package, not part of the standard library, so every Python install and every virtual environment needs its own copy. A brand-new venv has only pip in it, so the first import requests fails.

2. "I already ran pip install requests"

# "pip install requests" ran fine... but which Python did it install into?
pip --version
pip install -q --root-user-action=ignore requests
/tmp/venv/bin/python -c "import requests"

Output (sh -x, so each command is echoed with a +):

+ pip --version
pip 26.2.1 from /usr/local/lib/python3.14/site-packages/pip (python 3.14)
+ pip install -q '--root-user-action=ignore' requests
+ /tmp/venv/bin/python -c 'import requests'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

This is the most common version of the error. The install succeeded, but the bare pip on your PATH belongs to another Python (here the system one, see the path in pip --version), so requests went into that Python's site-packages and the venv still lacks it. The same thing happens when an IDE, Jupyter kernel, cron job or sudo runs a different interpreter from the one in your terminal.

3. Fix: install with the interpreter that fails

# Ask the failing interpreter which Python it is, then install with *that* one
/tmp/venv/bin/python -c "import sys; print(sys.executable)"
/tmp/venv/bin/python -m pip install -q requests
/tmp/venv/bin/python -c "import requests; print(requests.__version__, requests.__file__)"

Output (sh -x, so each command is echoed with a +):

+ /tmp/venv/bin/python -c 'import sys; print(sys.executable)'
/tmp/venv/bin/python
+ /tmp/venv/bin/python -m pip install -q requests
+ /tmp/venv/bin/python -c 'import requests; print(requests.__version__, requests.__file__)'
2.34.2 /tmp/venv/lib/python3.14/site-packages/requests/__init__.py

Print sys.executable from the failing script (or the IDE/Jupyter cell), then run <that path> -m pip install requests. python -m pip always installs into the Python you invoke it with, so the two can never point at different installs. Check where the import resolved with requests.__file__.

4. Typo: pip install request

# The import name is requests; there is no PyPI package called "request"
/tmp/venv/bin/python -m pip install -q request

Output (sh -x, so each command is echoed with a +):

+ /tmp/venv/bin/python -m pip install -q request
ERROR: Could not find a version that satisfies the requirement request (from versions: none)
ERROR: No matching distribution found for request

The package name and the import name are both requests, plural. On Debian 12+ and Ubuntu 23.04+ the system Python is marked externally managed (we confirmed /usr/lib/python3.13/EXTERNALLY-MANAGED on Debian 13), so pip refuses to install into it. Use a venv as above, or the distro package python3-requests.

Related: ModuleNotFoundError vs ImportError · No module named 'dotenv' · No module named 'yaml' · requests ConnectionError: Max retries exceeded.

Frequently asked questions

Why do I get No module named 'requests' after pip install requests?

The pip you ran belongs to a different Python than the one running your script. Run your script's interpreter with -m pip install requests.

How do I find which Python my script uses?

Print sys.executable inside the script, IDE or Jupyter cell, then install with that path: <path> -m pip install requests.

Is it pip install request or requests?

requests, plural. There is no PyPI package named request, so pip install request fails with No matching distribution found.

Written with AI assistance. Measured on 2026-10-23 in the python:3-alpine Docker image (Python 3.14, pip 26.2.1, requests 2.34.2): a fresh venv, a bare pip that installs into the system Python, the python -m pip fix, and pip install request. Every block was run verbatim and its output pasted unedited. PlainHeaders is our extension; Python and requests are free.