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

Most upvoted comments

Thanks @bashtage

  1. pip install statsmodels==0.10.0rc2 --pre

  2. Restarting 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.

it seems that this bug is fixed in 0.11.1 version, https://www.statsmodels.org/stable/release/version0.11.1.html

Thanks @tknows20. This happened to me with statsmodels 0.9.0 and was able to fix it by reinstalling statsmodels 0.12.2. Probably the most recent releases should have this issue solved as well. If someone (like me) used conda install -c conda-forge statsmodels the first time you installed statsmodels, a clean new installation (I did it this way) can be make by: conda remove -n yourenvhere statsmodels first, then conda list statsmodels to be sure it was deleted from my environment, and finally conda install statsmodels==0.12.2. Furthermore, I am using scipy 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 @bashtage

  1. pip install statsmodels==0.10.0rc2 --pre
  2. Restarting the kernel of the jupyter notebook

fixed it for me.

You can check your versions with pip list

Thanks. It fixed the issue for me too.

Thank you. This worked for me : python3.6 -m pip install scipy==1.2 --upgrade Credit: https://stackoverflow.com/questions/56283294/importerror-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:

Describe the bug

pip install statsmodels scipy now installs incompatible versions. #5619 https://github.com/statsmodels/statsmodels/issues/5619 but now with the default installation failing. All the more reason to finish #5620 https://github.com/statsmodels/statsmodels/issues/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 “”, line 1, in File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/api.py”, line 16, in 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 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 from .edgeworth import ExpandedNormal File “/home/AD/mthielk/miniconda3/envs/tmp2/lib/python3.6/site-packages/statsmodels/distributions/edgeworth.py”, line 7, in from scipy.misc import factorial ImportError: cannot import name ‘factorial’

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/statsmodels/statsmodels/issues/5747?email_source=notifications&email_token=ABKTSRMVKBDMFG4UKG4F35DPV7IR7A5CNFSM4HNZ7M32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUQ3OKA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKTSRNL4GMU664FV5DIM43PV7IR7ANCNFSM4HNZ7M3Q .