'Python 3.10: ModuleNotFoundError: No module named 'statsmodels' [duplicate]

I am trying to statsmodel. I installed statsmodel using the pip install statsmodels in the CMD terminal.

However every time I try to run the import statsmodels.api as sm in Spyder I get the following error:

ModuleNotFoundError: No module named 'statsmodels'

Do I have to add Spyder as into Windows Path to get access to the statsmodels library? Why is statsmodels not loading? Here is proof that I have it installed:

C:\Users\Jessica>pip list
Package         Version
--------------- -------
numpy           1.21.4
pandas          1.3.4
patsy           0.5.2
pip             21.3.1
python-dateutil 2.8.2
pytz            2021.3
scipy           1.7.2
setuptools      57.4.0
six             1.16.0
statsmodels     0.13.0


Solution 1:[1]

Simply run:

python -m pip install statsmodels

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aniket Babuta