Nothing named bs4 is installed in the Python that is running your code. Install the real library with `pip install beautifulsoup4` (the import name is bs4, the PyPI name is beautifulsoup4). Then confirm with `python -c "import bs4; print(bs4.__version__)"`. If it still fails, you installed into a different interpreter or environment than the one running the script.

## The error

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

## Fix it

1. **Install beautifulsoup4 into the interpreter you run**

```
python -m pip install beautifulsoup4
```
Expected: `Successfully installed beautifulsoup4-...`. Using `python -m pip` guarantees the package lands in the same interpreter that runs your script.

2. **Confirm the import**

```
python -c "import bs4; print(bs4.__version__)"
```
Expected: prints a version like `4.12.3`.

3. **If it still fails, check for a second Python**

```
which python
which python3
pip --version
```
Expected: the paths agree. When `pip` belongs to a different Python than `python`, installs go missing. Repeat step 1 with `python -m pip` and the mismatch disappears.

## When this applies

- the traceback is exactly `ModuleNotFoundError: No module named 'bs4'`
- a fresh machine, container, or venv where requirements were never installed
- CI fails on the import while your laptop works

## When it does NOT apply

- `ImportError: cannot import name 'BeautifulSoup' from 'bs4'` means something IS installed but it is the stub or a shadow file
- FeatureNotFound means bs4 imported fine and a parser is missing

## Compatibility

All beautifulsoup4 4.x, all Python 3 versions. The PyPI name has been `beautifulsoup4` since the beginning; the top-level import has always been `bs4`.

## Why it happens

The package's distribution name and import name differ: you `pip install beautifulsoup4` but you `import bs4`. People who guess `pip install bs4` either get ModuleNotFoundError (if nothing is installed) or worse, the dummy `bs4` 0.0.1 stub package. The other classic cause is installing into one Python while running another, which is why `python -m pip` is the reliable spelling.

## Edge cases

- Do NOT `pip install bs4`. That installs the 0.0.1 placeholder and converts this error into the nastier `cannot import name 'BeautifulSoup'` one.
- Conda users: `conda install beautifulsoup4` from defaults or conda-forge works the same.
- In Docker, make sure the pip install layer actually ran; a cached layer from before beautifulsoup4 was added to requirements silently skips it.
