ModuleNotFoundError: No module named 'parsel'
Fixes the plain missing-module error for parsel. Use when `import parsel` or `from parsel import Selector` fails with ModuleNotFoundError naming parsel. Not for missing w3lib/lxml underneath it.
parsel is not installed in the running Python. Run python -m pip install parsel and the import works. If it still fails, pip and python are different installations, so the python -m pip spelling matters.
The error
ModuleNotFoundError: No module named 'parsel'Fix it
- Install parsel
python -m pip install parselExpected: Successfully installed parsel-... with w3lib, lxml, and cssselect.
- Confirm
python -c "from parsel import Selector; print(Selector('hi').xpath('string()').get())"Expected: prints hi.
- If it still fails, check the interpreter split
python --version
pip --versionExpected: matching paths. Redo step 1 with python -m pip if they differ.
When this applies
- any parsel import fails naming
parsel - a fresh env, container, or CI runner
- you installed Scrapy but use parsel standalone elsewhere
When it does NOT apply
No module named 'w3lib'/'lxml'mean parsel is there but a dependency is not- Scrapy-only users get parsel transitively; this is for direct parsel use
Compatibility
parsel 1.x, Python 3.8+. Note parsel is also the selector engine inside Scrapy, so Scrapy installs already include it.
Why it happens
The package was never installed into the active interpreter. People hit this most often when a script runs under a different Python than the one they pip-installed into (system vs venv vs IDE-managed).
Edge cases
- Inside a Scrapy project you do not need to install parsel separately. If the import fails there anyway, the env itself is broken, not the package list.
- Older tutorials
pip install parsel-selector. The package was renamed toparsellong ago; install the current name.