Backward compatibility will be removed in Python 3.7. (Contributed by Yury Selivanov in bpo-27243.) A backslash-character pair that is not a valid escape sequence now generates a DeprecationWarning. Although this will eventually become a SyntaxError, that will not be for several Python releases. (Contributed by Emanuel Barry in bpo-27364.). 3.7 will receive bugfix updates approximately every 3 months for about 24 months. Sometime after the release of 3.8.0 final, a final 3.7 bugfix update will be released. After that, it is expected that security updates (source only) will be released as needed until 5 years after the release of 3.7 final, so until approximately 2023-06.

The easiest way to install statsmodels is to install it as part of the Anacondadistribution, a cross-platform distribution for data analysis and scientificcomputing. This is the recommended installation method for most users.

Instructions for installing from PyPI, source or a development version are also provided.

  • Under the “Python Releases for Mac OS X” heading, click the link for the Latest Python 3 Release - Python 3.x.x. As of this writing, the latest version was Python 3.8.4. Scroll to the bottom and click macOS 64-bit installer to start the download. When the installer is finished downloading, move on to the next step. Step 2: Run the Installer.
  • Python is a popular, stable, and well-performing programming language. Many different Linux distributions use it, including CentOS 7. CentOS 7 uses Python 2.7.5, but as Python has updated to 3.7.2., this can create challenges. If the default version of Python is updated, it can break base system components like the yum package manager.
  • It is strongly recommended to use 64-bit Python if possible. Getting the right compiler is especially confusing for Windows users. Over time, Python has been built using a variety of different Windows C compilers. This guide should help clarify which version of Python uses which compiler by default.

Python Support¶

statsmodels supports Python 3.6, 3.7 and 3.8.

Anaconda¶

statsmodels is available through conda provided byAnaconda. The latest release canbe installed using:

PyPI (pip)¶

To obtain the latest released version of statsmodels using pip:

Follow this link to our PyPI page to directlydownload wheels or source.

For Windows users, unofficial recent binaries (wheels) are occasionallyavailable here.

Obtaining the Source¶

We do not release very often but the master branch of our source code isusually fine for everyday use. You can get the latest source from ourgithub repository. Or if youhave git installed:

If you want to keep up to date with the source on github just periodically do:

in the statsmodels directory.

Installation from Source¶

You will need a C compiler installed to build statsmodels. If you are buildingfrom the github source and not a source release, then you will also needCython. You can follow the instructions below to get a C compiler setup forWindows.

If your system is already set up with pip, a compiler, and git, you can try:

If you do not have pip installed or want to do the installation more manually,you can also type:

Or even more manually

statsmodels can also be installed in develop mode which installs statsmodelsinto the current python environment in-place. The advantage of this is thatedited modules will immediately be re-interpreted when the python interpreterrestarts without having to re-install statsmodels.

Compilers¶

Linux¶

If you are using Linux, we assume that you are savvy enough to install gcc onyour own. More than likely, it is already installed.

Update Python To 3.7 Mac

Upgrade Python 3.4 To 3.7 Mac

Windows¶

It is strongly recommended to use 64-bit Python if possible.

Getting the right compiler is especially confusing for Windows users. Over time,Python has been built using a variety of different Windows C compilers.This guide should helpclarify which version of Python uses which compiler by default.

Mac¶

Installing statsmodels on MacOS requires installing gcc which providesa suitable C compiler. We recommend installing Xcode and the Command LineTools.

Dependencies¶

The current minimum dependencies are:

  • Python >= 3.6

  • NumPy >= 1.15

  • SciPy >= 1.2

  • Pandas >= 0.23

  • Patsy >= 0.5.1

Cython is required to build from a git checkout but not to run or install from PyPI:

  • Cython >= 0.29 is required to build the code fromgithub but not from a source distribution.

Update Python 2.7 To 3.7 Macos

Given the long release cycle, statsmodels follows a loose time-based policy fordependencies: minimal dependencies are lagged about one and a half to twoyears. Our next planned update of minimum versions is expected in the firsthalf of 2020.

Optional Dependencies¶

Upgrade Python 2.7 To 3.7 Macos

  • cvxopt is required for regularized fitting ofsome models.

  • Matplotlib >= 2.2 is needed for plottingfunctions and running many of the examples.

  • If installed, X-12-ARIMA orX-13ARIMA-SEATS can be usedfor time-series analysis.

  • pytest is required to runthe test suite.

  • IPython >= 5.0 is required to build thedocs locally or to use the notebooks.

  • joblib >= 0.9 can be used to accelerate distributedestimation for certain models.

  • jupyter is needed to run the notebooks.