ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built
Fixes ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built Use when `import pandas` raises the 'C extension ... not built' ImportError naming a pandas._libs module Not for: plain `No module named 'pandas'` or a missing optional dependency like openpyxl
How to fix ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built
You are importing pandas from a source checkout whose C extensions were never built. Either build them or just install a binary wheel with pip. Most people hitting this should do the pip reinstall: the error only appears when a source directory shadows a working install.
The exact error
ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not builtFix it
- Check whether you are inside the pandas source dir:
pwdand look for setup.py. If yes, cd out.
Expected: you know whether the source tree is shadowing the install
- Simplest fix:
python -m pip install --force-reinstall pandas.
Expected: python -c "import pandas; print(pandas.__version__)" works from any directory
- If you actually develop pandas: build the extensions in place, then import again.
Expected: the C extensions build and import succeeds
When this applies
import pandas raises the 'C extension ... not built' ImportError naming a pandas._libs module
When this does NOT apply
plain No module named 'pandas' or a missing optional dependency like openpyxl
Versions
pandas built from source / dev installs, any version
Why it happens
pandas ships compiled Cython extensions. A source checkout (or a copied pandas folder) without built extensions cannot import.
Edge cases
Do not run your scripts from inside the pandas repo directory; the local pandas/ folder shadows site-packages.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.