Scrapy is not installed in the Python that is running. Run `python -m pip install scrapy` and both the import and the `scrapy` CLI start working. If it still fails, your `pip` and your `python` belong to different installations, so always spell it `python -m pip`.

## The error

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

## Fix it

1. **Install Scrapy with the running interpreter's pip**

```
python -m pip install scrapy
```
Expected: `Successfully installed scrapy-...` plus its dependencies.

2. **Confirm the import and the CLI**

```
python -c "import scrapy; print(scrapy.__version__)"
scrapy version
```
Expected: both print a version like `2.11.0`.

3. **If the import still fails, find the interpreter mismatch**

```
python --version
pip --version
```
Expected: the paths in the two outputs match. If they do not, the install went to a different Python. Redo step 1 exactly as written.

## When this applies

- `import scrapy` or `scrapy crawl`/`scrapy version` fails naming `scrapy`
- a new machine, container, or venv
- the tutorial said `pip install scrapy` but your shell has several Pythons

## When it does NOT apply

- `No module named 'twisted'` means Scrapy is there but Twisted is not
- `No module named 'win32api'` is the Windows pywin32 gap
- an ImportError inside scrapy's own modules is a broken install, reinstall with --force-reinstall

## Compatibility

All Scrapy 2.x. Needs Python 3.8+. On Windows the installer also wants pywin32 (see the win32api skill).

## Why it happens

Nothing more exotic than a missing install, but Scrapy is big enough that people often install it into one Python (say the system one) while their project runs under another (a venv, conda env, or IDE-managed interpreter). `python -m pip` removes the ambiguity by tying the installer to the interpreter.

## Edge cases

- Portia and other Scrapy-based tools hit this when their bundled env is not activated. Activate the env first, then check.
- On Debian/Ubuntu, `pip install scrapy` may try building Twisted from source on old Pythons. Prefer a newer Python with wheels.
- `scrapy` command not found after install means the Scripts/bin dir is not on PATH. `python -m scrapy` works as a fallback.
