statsmodels: ImportError: cannot import name 'factorial' with pip installed packages
Describe the bug
pip install statsmodels scipy now installs incompatible versions. #5619 but now with the default installation failing. All the more reason to finish #5620.
Code Sample, a copy-pastable example if possible
from statsmodels.formula.api import ols
or even
import statsmodels.api as sm
Expected Output
pip installing the package shouldn’t install incompatible types.
Output of import statsmodels.api as sm; sm.show_versions()
import statsmodels.api as sm; sm.show_versions() Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/api.py”, line 16, in <module> from .discrete.discrete_model import (Poisson, Logit, Probit, File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py”, line 45, in <module> from statsmodels.distributions import genpoisson_p File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/distributions/init.py”, line 2, in <module> from .edgeworth import ExpandedNormal File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/distributions/edgeworth.py”, line 7, in <module> from scipy.misc import factorial ImportError: cannot import name ‘factorial’
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 16
- Comments: 20 (5 by maintainers)
Commits related to this issue
- changed order of imports This has to do with overcoming the issue created by scipy 1.3. https://github.com/statsmodels/statsmodels/issues/5747 — committed to autonomio/wrangle by mikkokotila 5 years ago
Thanks @bashtage
pip install statsmodels==0.10.0rc2 --preRestarting the kernel of the jupyter notebook
fixed it for me.
You can check your versions with
pip list@avitomar12 You should use the latest release. Just pip install statsmodels --upgrade.
Thanks @tknows20. This happened to me with
statsmodels 0.9.0and was able to fix it by reinstallingstatsmodels 0.12.2. Probably the most recent releases should have this issue solved as well. If someone (like me) usedconda install -c conda-forge statsmodelsthe first time you installedstatsmodels, a clean new installation (I did it this way) can be make by:conda remove -n yourenvhere statsmodelsfirst, thenconda list statsmodelsto be sure it was deleted from my environment, and finallyconda install statsmodels==0.12.2. Furthermore, I am usingscipy 1.5.2.it seems that this bug is fixed in 0.11.1 version, https://www.statsmodels.org/stable/release/version0.11.1.html
Thanks. It fixed the issue for me too.
Thank you. This worked for me :
python3.6 -m pip install scipy==1.2 --upgradeCredit: https://stackoverflow.com/questions/56283294/importerror-cannot-import-name-factorialI suspect there will be quite a few issues because of this. See, for example, https://stackoverflow.com/questions/56206632/while-importing-auto-arima-from-pmdarima-error-cannot-import-name-factorial
You need to downgrade your scipy or install statsmodels from master
On Sat, May 18, 2019, 11:08 Marvin T notifications@github.com wrote: