close

[Solved] ImportError: No module named statsmodels

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error ImportError: No module named statsmodels in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named statsmodels Error Occurs?

Today I get the following error ImportError: No module named statsmodels in python.

How To Solve ImportError: No module named statsmodels Error ?

  1. How To Solve ImportError: No module named statsmodels Error ?

    To Solve ImportError: No module named statsmodels Error if you facing an error like no module pasty stop your jupyter notebook and try the below command on terminal

  2. ImportError: No module named statsmodels

    To Solve ImportError: No module named statsmodels Error if you facing an error like no module pasty stop your jupyter notebook and try the below command on terminal

Solution 1

  • you shouldn’t untar it to /usr/local/lib/python2.7/dist-packages (you could use any temporary directory)
  • you might have used by mistake a different python executable e.g., /usr/bin/python instead of the one corresponding to /usr/local/lib/python2.7

You should use pip corresponding to a desired python version (use python -V to check the version) to install it:

$ python -m pip install statsmodels 

It would allow you to upgrade/uninstall it easily.

Don’t install as a root to avoid the risk of messing with system python installation by accident. You could use --user option or virtualenv instead.

Solution 2

As per documentation, you can install using the following commands

pip install --upgrade --no-deps statsmodels

using conda

conda install statsmodels

Then restart your jupyter notebook

if you facing an error like no module pasty stop your jupyter notebook and try the below command on terminal

pip install patsy

Don’t forget to restart your jupyter notebook Let’s hope

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read