You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImportError: cannot import name 'factorial' with pip installed packages #5747
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
fromstatsmodels.formula.apiimportols
or even
importstatsmodels.apiassm
Expected Output
pip installing the package shouldn't install incompatible types.
Output of import statsmodels.api as sm; sm.show_versions()
Details
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'
Reacted by ciberger, Cpop, Taylor G Smith, Riyad Parvez, Samuel Marks, Ryan Orsinger, Thierry Herrmann, Anton Yakutovich, George Ho, shenjianlxx and 6 more
On Sat, May 18, 2019, 11:08 Marvin T ***@***.***> wrote:
Describe the bug
pip install statsmodels scipy now installs incompatible versions. #5619
<#5619> but now with the
default installation failing. All the more reason to finish #5620
<#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
<#5747?email_source=notifications&email_token=ABKTSRMVKBDMFG4UKG4F35DPV7IR7A5CNFSM4HNZ7M32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUQ3OKA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKTSRNL4GMU664FV5DIM43PV7IR7ANCNFSM4HNZ7M3Q>
.
thanks @bashtage.
For other users: If you use databricks, then this dbutils command would work: dbutils.library.installPyPI('statsmodels','0.10.0rc2')
Also need to detach - re attach the notebook to a cluster on which another version of statsmodels is installed
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.
Activity
bashtage commentedon May 18, 2019
WarrenWeckesser commentedon May 19, 2019
I 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
bashtage commentedon May 19, 2019
I agree. Hope to have one soonish (read 1 month).
cpoptic commentedon May 20, 2019
What's the current fix to this?
bashtage commentedon May 20, 2019
See #5759
geethikabhavya commentedon May 23, 2019
Kindly let me know how to fix this - how do I downgrade scipy?
MarvinT commentedon May 24, 2019
How did you install scipy? pip or conda?
geethikabhavya commentedon May 24, 2019
Thank you. This worked for me :
python3.6 -m pip install scipy==1.2 --upgradeCredit: https://stackoverflow.com/questions/56283294/importerror-cannot-import-name-factorial
changed order of imports
SachitNayak commentedon Jun 8, 2019
Hi,
I'm still facing the issue, and I do not want to downgrade scipy... is the fix for the issue on the way for the next release?
bashtage commentedon Jun 8, 2019
SachitNayak commentedon Jun 11, 2019
@bashtage Thank you so much!
clemenspeters commentedon Jun 18, 2019
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 listybenita1234 commentedon Jun 18, 2019
Thanks. It fixed the issue for me too.
jorellano commentedon Jul 21, 2019
Thank you. works now
avitomar12 commentedon Apr 24, 2020
Thanks @bashtage
Worked for me.
bashtage commentedon Apr 24, 2020
@avitomar12 You should use the latest release. Just pip install statsmodels --upgrade.
avitomar12 commentedon Apr 24, 2020
@bashtage thanks
Yeah It worked. I used this in another machine.
srivats0603 commentedon Apr 28, 2020
thanks @bashtage.
For other users: If you use databricks, then this dbutils command would work:
dbutils.library.installPyPI('statsmodels','0.10.0rc2')Also need to detach - re attach the notebook to a cluster on which another version of statsmodels is installed
tknows20 commentedon Jul 29, 2020
it seems that this bug is fixed in 0.11.1 version, https://www.statsmodels.org/stable/release/version0.11.1.html
Manuelhrokr commentedon Sep 2, 2022
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) used
conda 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.