How to Install moto in Python

v5.1.22 Testing & QA Python >=3.9 Apache-2.0

A library that allows you to easily mock out tests based on AWS infrastructure

Install pip install moto

What is moto?

A library that allows you to easily mock out tests based on AWS infrastructure

Moto is a library that allows your tests to easily mock out AWS Services.

Imagine you have the following python code that you want to test:

Take a minute to think how you would have tested that in the past.

Quick Start

Minimal example to get started with moto:

import moto

print(moto.__version__)

Installation

pip (standard)

pip install moto

Virtual environment (recommended)

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

pip3

pip3 install moto

conda

conda install -c conda-forge moto

Poetry

poetry add moto

Dependencies

Installing moto will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import moto; print(moto.__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 moto with pip.

ModuleNotFoundError: No module named 'moto'

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

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

ModuleNotFoundError: No module named 'moto' (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 moto to install into the interpreter you are running.

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

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

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

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 moto. 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 moto

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 moto

Recent Releases

VersionReleased
5.1.23.dev86 2026-03-28
5.1.22 latest 2026-03-08
5.1.22.dev74 2026-03-06
5.1.21 2026-02-08
5.1.20 2026-01-17

Full release history on PyPI →

Manage moto

Upgrade to latest version

pip install --upgrade moto

Install a specific version

pip install moto==5.1.22

Uninstall

pip uninstall moto

Check what is installed

pip show moto

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