The selenium package is not installed in the Python running your script. Run `python -m pip install selenium` and the import works. If it still fails, you installed into a different interpreter than the one running the code, so always use the `python -m pip` spelling.

## The error

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

## Fix it

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

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

2. **Confirm the import**

```
python -c "from selenium import webdriver; print(selenium.__version__ if False else 'ok')"
```
Expected: prints `ok`. (The version lives at `selenium.__version__` if you need it.)

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

```
python --version
pip --version
```
Expected: both lines reference the same installation. If not, redo step 1 and skip bare `pip`.

## When this applies

- any `from selenium import ...` fails with ModuleNotFoundError naming selenium
- a new venv, container, or CI runner
- the script worked on another machine

## When it does NOT apply

- `ImportError: cannot import name 'webdriver' from 'selenium'` means a shadowing selenium.py file
- chromedriver PATH errors happen after the import succeeds

## Compatibility

selenium 4.x current. Needs Python 3.8+. `pip install selenium` on Python 2 installs the ancient 3.141 line, which is not what you want.

## Why it happens

The package was never installed into the active environment, or it was installed into a different Python. This bites hardest with IDE-managed interpreters and with `pip` vs `pip3` pointing at different installations.

## Edge cases

- On Debian/Ubuntu, never `apt install python3-selenium` and `pip install selenium` in the same env. Pick one package manager.
- If your project pins selenium in requirements.txt, install the file (`pip install -r requirements.txt`) rather than the bare package so versions stay consistent.
