Scrapy is built on Twisted for its async networking, and if Twisted is not installed Scrapy cannot even import. Run `python -m pip install twisted` (or just reinstall Scrapy with `python -m pip install --force-reinstall scrapy`, which pulls Twisted back in). `import scrapy` then works.

## The error

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

## Fix it

1. **Install Twisted into the running environment**

```
python -m pip install twisted
```
Expected: `Successfully installed twisted-...`.

2. **Confirm the Scrapy import**

```
python -c "import scrapy; print(scrapy.__version__)"
```
Expected: prints the Scrapy version with no ModuleNotFoundError.

3. **If it still fails, reinstall Scrapy so its dependency set is complete**

```
python -m pip install --force-reinstall scrapy
```
Expected: pip reinstalls scrapy and all of its declared dependencies, including twisted.

## When this applies

- `import scrapy` or `scrapy crawl` fails naming `twisted`
- Twisted was uninstalled or never pulled in by a partial install
- a minimal Docker image or venv where only some requirements got installed

## When it does NOT apply

- `No module named 'scrapy'` means Scrapy itself is missing
- `No module named 'win32api'` is the Windows pywin32 gap
- Twisted installs fine but `scrapy` still fails on something else

## Compatibility

All Scrapy 2.x versions depend on Twisted. Twisted publishes wheels for CPython 3.8+ on Windows, macOS, and Linux.

## Why it happens

Scrapy does `import twisted` (via twisted.internet) at module import time, not lazily. Dependency resolvers normally install Twisted alongside Scrapy, but a `--no-deps` install, a botched uninstall, or a requirements file that lists scrapy without letting pip resolve dependencies can leave Twisted out while Scrapy itself is present.

## Edge cases

- If you installed with `pip install --no-deps scrapy`, reinstall normally. The --no-deps flag is the usual culprit.
- Twisted on Windows needs the Visual C++ build tools only for source builds; wheels make this a non-issue on supported Pythons.
- After installing, run `scrapy version` (not just the import) to confirm the CLI entry point works too.
