How to Install statsmodels in Python
Statistical computations and models for Python
pip install statsmodels
What is statsmodels?
Statistical computations and models for Python
|PyPI Version| |Conda Version| |License| |Azure CI Build Status| |Codecov Coverage| |Coveralls Coverage| |PyPI downloads| |Conda downloads|
statsmodels is a Python package that provides a complement to scipy for statistical computations including descriptive statistics and estimation and inference for statistical models.
The documentation for the latest release is at
Quick Start
Minimal example to get started with statsmodels:
import statsmodels
print(statsmodels.__version__)
Installation
pip (standard)
pip install statsmodels
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install statsmodels
pip3
pip3 install statsmodels
conda
conda install -c conda-forge statsmodels
Poetry
poetry add statsmodels
Dependencies
Installing statsmodels will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import statsmodels; print(statsmodels.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing statsmodels with pip.
ModuleNotFoundError: No module named 'statsmodels'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install statsmodels. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'statsmodels' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install statsmodels to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'statsmodels'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show statsmodels and upgrade with pip install --upgrade statsmodels.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install statsmodels. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user statsmodels
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org statsmodels
MemoryError when loading data
Cause: Dataset is too large to fit in RAM.
Fix: Read in chunks, filter columns on load, or consider Polars/Dask for out-of-core processing.
Recent Releases
| Version | Released |
|---|---|
0.14.6 latest |
2025-12-05 |
0.14.5 |
2025-07-07 |
0.14.4 |
2024-10-03 |
0.14.3 |
2024-09-16 |
0.14.2 |
2024-04-17 |
Manage statsmodels
Upgrade to latest version
pip install --upgrade statsmodels
Install a specific version
pip install statsmodels==0.14.6
Uninstall
pip uninstall statsmodels
Check what is installed
pip show statsmodels