Whoosh ImportError on modern Python — why it happens and the fix

by Priya Sundaram · 16 July 2026
Short answer: The original Whoosh 2.7.4 (last released in 2016) does not run on Python 3.10 and newer. You get errors like ImportError: cannot import name 'Iterable' from 'collections' or ModuleNotFoundError: No module named 'imp'. The fix is a drop-in replacement:
pip uninstall -y whoosh whoosh-reloaded
pip install whoosh3
Your import whoosh statements, your code, and your existing on-disk indexes all keep working — whoosh3 keeps the same import name and API and is tested on Python 3.10–3.14.

The errors you are probably seeing

If you just upgraded Python (or deployed to a newer runtime) and your search code stopped working, the traceback most likely ends with one of these:

ImportError: cannot import name 'Iterable' from 'collections'
ImportError: cannot import name 'Mapping' from 'collections'
ModuleNotFoundError: No module named 'imp'
AttributeError: module 'inspect' has no attribute 'getargspec'

These are not bugs in your code. They are the symptoms of a library that was written for an older Python and never updated for the changes that landed in Python 3.10, 3.12, and beyond.

Why it happens

Two long-planned removals in CPython are the usual culprits:

The original Whoosh 2.7.4 predates all of this, and it is no longer being patched, so it simply does not import on current interpreters.

The fix

The maintained continuation of Whoosh is published on PyPI as whoosh3. It fixes the imports (they now come from collections.abc), drops imp, and is tested in CI on CPython 3.10 through 3.14 and on PyPy. Crucially, it keeps the import name whoosh, so nothing in your source has to change.

# remove whichever old package you have
pip uninstall -y whoosh whoosh-reloaded

# install the maintained continuation
pip install whoosh3

Then your existing code runs unchanged:

from whoosh.index import create_in
from whoosh.fields import Schema, TEXT, ID
from whoosh.qparser import QueryParser

schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
ix = create_in("indexdir", schema)

writer = ix.writer()
writer.add_document(title="First doc", path="/a", content="hello whoosh")
writer.commit()

with ix.searcher() as s:
    q = QueryParser("content", ix.schema).parse("whoosh")
    for hit in s.search(q):
        print(hit["title"])

Do I have to rebuild my index?

No. The on-disk index format is unchanged, so indexes written by older Whoosh open fine under whoosh3. The whole point of the continuation is that it is a maintenance fork, not a rewrite: same import name, same public API, same file format — just running on modern Python.

Which package is which?

PyPI packageImport nameStatus
whoosh (2.7.4)whooshOriginal, last release 2016 — breaks on Python 3.10+
whoosh-reloadedwhooshCommunity fork, now inactive
whoosh3whooshActively maintained, Python 3.10–3.14

All three install under the whoosh import name, so only one can be installed at a time. If you are unsure what you have, run pip show whoosh whoosh3 whoosh-reloaded and uninstall everything except whoosh3.

Still stuck?

If pip install whoosh3 does not resolve your traceback, that is a bug I want to know about. Open an issue with your Python version and the full traceback on the issue tracker and I will take a look.

The one-line fix:

pip install whoosh3

Prefer to see it work first? Run a real search index live in your browser (no install). If this saved you some debugging, a star on GitHub helps other people find the maintained version.

See also: Is Whoosh still maintained? · Full-text search in Flask · Full-text search in Django.