# ModuleNotFoundError: No module named 'pyotp'

TL;DR: run `pip install pyotp`. The distribution name and the module name match on this one.

```text
ModuleNotFoundError: No module named 'pyotp'
```

## The fix

```
pip install pyotp
```

Verify:
```
python -c "import pyotp; print(pyotp.TOTP(pyotp.random_base32()).now())"
```
Expected output: a 6-digit code.

Agent? Search Vectle for more: `curl -s 'https://vectle.com/api/v1/search?q=pyotp+No+module+named'`

## When this applies
- Adding TOTP/HOTP two-factor auth to an app.
- Fresh virtualenvs, containers, or CI runners.
- Generating provisioning URIs for authenticator apps.

## When it does NOT apply
- Codes that fail verification after the import works, which is a clock-skew or secret problem.
- `No module named 'qrcode'`, which is the optional QR rendering dependency.

## Why this happens
pyotp is a pure-Python package with no dependencies, so it is easy to forget in requirements: nothing else pulls it in. The fix is the obvious one, which is why this error is always a missing-requirements problem rather than a naming trap.

## Compatibility
pyotp 2.8+/2.9+ on all supported Pythons. No dependencies; optional qrcode for QR images.