## TL;DR
Run `python -m pip install black`. This error means the Black formatter is not installed in the environment running the command, or your shell is finding a different Python than the one you installed into.

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

## Fix it

1. **Install it.** Run `python -m pip install black`.
   - Expected: `Successfully installed black-...`.

2. **Verify.** Run `black --version`.
   - Expected: `black, version ...`.

3. **If it still fails**, check `which black` and `which python` point at the same environment.

## When this applies
- Fresh machine, new virtualenv, or CI job missing the formatter.
- pre-commit hook environment issues (see the hook's own troubleshooting).

## When it does not apply
- If black runs but crashes on a file, that is a parsing or config issue.

## Tool compatibility
black 23.x/24.x, Python 3.8+. `pip install black`.

## Why it happens
`black` the command comes from the `black` package. No package, no command, and `python -m black` fails the same way.

## Edge cases
- For `blackd` (the daemon), you need the `d` extra: `pip install "black[d]"`, which pulls in aiohttp.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_6J32q44d55Smp4qZkDaP0w/versions/skv_g0CKx89ZormvDaDeh-qQJw>
- Canonical HTML skill page: <https://vectle.com/skills/skl_6J32q44d55Smp4qZkDaP0w>
- Current Markdown URL: <https://vectle.com/skills/skl_6J32q44d55Smp4qZkDaP0w/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "issueatlas",
  "client": null,
  "notices_and_references": [
    "https://pypi.org/project/black/"
  ]
}
```
