Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

The standard command is python -m pip install requests. For Unix and macOS, the Python Packaging User Guide shows python3 -m pip install requests; on Windows, use py -m pip install requests. For most projects, create and activate a virtual environment first so Requests is installed for that project rather than an unrelated or system Python.

Before you install: choose the Python interpreter

Requests is a Python package published on PyPI. The safest habit is to run pip through the interpreter you intend to use: python -m pip, python3 -m pip, or, on Windows, py -m pip. This avoids a common mismatch where one Python receives the package but a different Python runs your program.

Open Terminal on macOS or a Unix-like system, or PowerShell or Command Prompt on Windows. Check that Python is available:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Unix/macOS: python3 --version
  • Windows: py --version

If a command is not recognized, install Python or correct your PATH before trying to install Requests. The launcher names can vary by setup; use the command that identifies the interpreter you will actually run.

Way 1: Install Requests from PyPI with pip

This is the usual choice when you want the published Requests package. The Requests documentation gives python -m pip install requests as its basic command. The Packaging User Guide uses platform-specific launchers.

Unix and macOS

  1. Open Terminal.
  2. Run python3 -m pip install requests.
  3. Wait for pip to download and install Requests and its dependencies.

Windows

  1. Open PowerShell or Command Prompt.
  2. Run py -m pip install requests.
  3. Wait for pip to finish installing the package.

If your system’s python command points to the desired interpreter, the cross-platform form is python -m pip install requests. Using -m pip is important: it runs pip as a module belonging to that specific Python installation.

Check that the installation works

Run a version check using the same launcher you used to install:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Unix/macOS: python3 -c "import requests; print(requests.__version__)"
  • Windows: py -c "import requests; print(requests.__version__)"

The command should print the installed Requests version without an import error. To make a simple HTTP request, save this as check_requests.py and run it with that same Python:

import requests

response = requests.get("https://example.com", timeout=20)
print(response.status_code)
print(response.url)

The request needs an internet connection, and the remote server must respond. A timeout or HTTP error from this check does not, by itself, mean the package failed to install; the import and version check isolate the installation test.

Way 2: Install Requests in a virtual environment

A virtual environment isolates a project’s installed packages from other projects and from the system Python. This is the recommended route for most application work: create one environment for the project, activate it, then install Requests inside it. Python’s packaging guide demonstrates installing Requests in an activated virtual environment.

Create and activate the environment

First, change to your project directory. Create an environment named .venv:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
# Unix/macOS
python3 -m venv .venv

# Windows
py -m venv .venv

Activate it in the shell you are using:

# Unix/macOS, bash or zsh
source .venv/bin/activate

# Windows, PowerShell
.venvScriptsActivate.ps1

# Windows, Command Prompt
.venvScriptsactivate.bat

When activation succeeds, the environment’s name commonly appears in the shell prompt. Install Requests using the active environment’s Python:

python -m pip install requests

Then verify it:

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

Once activated, python should refer to the environment’s interpreter, so the same command works across the listed platforms. Run your project scripts from this activated shell to use the same installation. To leave the environment, run deactivate.

Why use a virtual environment?

  • Project isolation: installing or changing a dependency for one project does not change another project’s environment.
  • Interpreter clarity: activation makes it easier to install and run with the same Python.
  • Safer dependency management: you avoid changing packages in a system-managed Python installation.

If venv is unavailable, confirm that the Python installation includes the standard-library venv module. Do not work around the issue by installing into an unintended system interpreter; correct or install the intended Python environment first.

Way 3: Install Requests from its source repository

Install from source when you need the repository checkout rather than the published package, for example when contributing to Requests. The official instructions use Git to clone the public repository and pip to install the checkout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the checkout

  1. Clone the repository: git clone https://github.com/psf/requests.git.
  2. Move into the new directory: cd requests.
  3. Install the checked-out project: python -m pip install ..
git clone https://github.com/psf/requests.git
cd requests
python -m pip install .

Run these commands with the Python environment where you want Requests installed; for project work, activate a virtual environment first. If Git is not available, the official instructions also allow downloading the repository tarball, then running the install command from the extracted project directory.

Editable installation for development

If you are actively changing the source, use pip’s editable mode from the repository directory:

python -m pip install --editable .

Editable mode makes changes in the source directory take effect in the installed project without repeating a regular installation after every edit. It is intended for development, not as the normal way to install the published release for application use.

Which installation method should you use?

Method Best fit Command pattern
PyPI with pip You want the published Requests package quickly. python -m pip install requests
Virtual environment You want dependencies isolated for a project; this is the best default for most projects. Create and activate .venv, then python -m pip install requests.
Source checkout You need repository source or are contributing to Requests. python -m pip install . in the checkout; use --editable . for active development.

Python version compatibility

Compatibility statements depend on which Requests release information you consult. PyPI’s metadata for Requests 2.32.5, published on 2025-08-18, lists Python 3.9–3.14 classifiers and PyPy. The current Requests documentation line states official support for Python 3.10 and later. These are different contexts: a release’s PyPI classifiers are not the same statement as the current documentation’s support policy. If your project depends on a particular Python version, check the metadata and installation guidance for the Requests release you plan to use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Installing when the normal PyPI route is unavailable

If your machine cannot reach the usual package index, pip supports other sources. The appropriate route depends on what you have available:

  • Local wheel or source archive: pass the archive path to pip, for example python -m pip install ./path/to/package.whl.
  • Offline package directory: use --no-index --find-links to tell pip to search a local directory rather than an index.
  • Another package index: use --index-url to select an index, or --extra-index-url to add one.
  • Version-control source: pip can install from version control when that is the workflow you need; installing a local checkout is shown above.

For offline installation, ensure the directory contains the required distribution files, including any dependencies your environment does not already have. An index option only helps if the selected index is reachable and contains the package versions you need.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting installation and import errors

pip is not recognized or not found

Use an interpreter-qualified command instead of invoking pip directly: python3 -m pip on Unix/macOS or py -m pip on Windows. If the interpreter command itself fails, install Python or correct the system PATH.

Installation succeeds, but import requests fails

The package may have been installed into a different Python than the one running the script. Re-run the installation through the interpreter used to launch the program, such as python -m pip install requests, then test python -c "import requests" with that same command. If using a virtual environment, activate it before both installation and execution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Permission denied or a system-managed Python warning

You may be attempting to modify a Python installation managed by the operating system or another tool. Use a project virtual environment and install there rather than forcing a system-wide change. This also avoids altering dependencies used by unrelated projects.

The shell cannot activate the Windows PowerShell environment

Confirm that the environment exists at .venv and that you are in the project directory. In PowerShell, use .venvScriptsActivate.ps1; in Command Prompt, use .venvScriptsactivate.bat. If your shell blocks the activation script, you can invoke the environment’s Python directly: .venvScriptspython.exe -m pip install requests, then run scripts with that executable.

Network, index, or download errors

Check network access and the configured package index. If the normal index cannot be used, select an available index with --index-url, add a secondary one with --extra-index-url, or install from a local wheel or source archive. For a disconnected machine, prepare the needed distributions in an accessible directory and use --no-index --find-links.

Source installation fails

Check that Git is installed for the clone step, that you changed into the repository directory, and that the command ends with a dot: python -m pip install .. For development, run python -m pip install --editable . from that same directory. In both cases, ensure the command targets the environment you intend to use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

If you installed Requests because you need to retrieve website screenshots, you can call ScreenshotNeo’s screenshot API directly instead of managing browser automation. One GET request returns an image or PDF; see the API documentation for parameters and response details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Learn more at ScreenshotNeo. Sign up free for 1,000 screenshots a month, no card required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.