How to Install requests in Python

v2.33.1 Web & HTTP Python >=3.10 Apache-2.0

Python HTTP for Humans.

Install pip install requests

What is requests?

Python HTTP for Humans.

Requests is a simple, yet elegant, HTTP library.

Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your & data — but nowadays, just use the method!

Requests is one of the most downloaded Python packages today, pulling in around — according to GitHub, Requests is currently depended upon by repositories. You may certainly put your trust in this code.

Quick Start

Minimal example to get started with requests:

import requests

r = requests.get("https://api.github.com/repos/psf/requests")
print(r.status_code)      # 200
data = r.json()
print(data["full_name"])  # psf/requests

Installation

pip (standard)

pip install requests

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install requests

pip3

pip3 install requests

conda

conda install -c conda-forge requests

Poetry

poetry add requests

Dependencies

Installing requests will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import requests; print(requests.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing requests with pip.

ModuleNotFoundError: No module named 'requests'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install requests. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'requests' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install requests to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'requests'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show requests and upgrade with pip install --upgrade requests.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install requests. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user requests

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org requests

ConnectionError: Failed to establish a new connection

Cause: Server unreachable, URL invalid, or firewall/proxy blocking the connection.

Fix: Verify the URL and network access. Set HTTP_PROXY / HTTPS_PROXY env vars if behind a proxy.

SSLError: CERTIFICATE_VERIFY_FAILED

Cause: The remote server's SSL certificate cannot be verified.

Fix: Update CA certificates on your system. For testing only, disable SSL verification (never in production).

Runtime Errors

Common errors when using requests after installation.

requests.exceptions.ConnectionError

Cause: The server is unreachable, the URL is wrong, or the network is down.

Fix: Verify the URL is correct and the server is up. Check HTTP_PROXY / HTTPS_PROXY if behind a proxy.

requests.exceptions.Timeout

Cause: The server did not respond within the timeout window.

Fix: Set an explicit timeout: requests.get(url, timeout=10)

requests.exceptions.HTTPError (4xx / 5xx)

Cause: The server returned an error status code.

Fix: Call response.raise_for_status() to raise on error, or check response.status_code first.

requests.exceptions.TooManyRedirects

Cause: The URL redirected more than 30 times.

Fix: Check for redirect loops. Debug with allow_redirects=False.

Recent Releases

VersionReleased
2.33.1 latest 2026-03-30
2.33.0 2026-03-25
2.32.5 2025-08-18
2.32.4 2025-06-09
2.32.3 2024-05-29

Full release history on PyPI →

Manage requests

Upgrade to latest version

pip install --upgrade requests

Install a specific version

pip install requests==2.33.1

Uninstall

pip uninstall requests

Check what is installed

pip show requests

Last updated: 2026-04-11 • Data from PyPI