Skip to content

ImportError: cannot import name 'factorial' with pip installed packages #5747

Closed

Description

@MarvinT

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()

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'

Activity

  1. bashtage commented on May 18, 2019

    @bashtage
    Member
  2. WarrenWeckesser commented on May 19, 2019

    @WarrenWeckesser
  3. bashtage commented on May 19, 2019

    @bashtage
    Member

    I agree. Hope to have one soonish (read 1 month).

  4. cpoptic commented on May 20, 2019

    @cpoptic

    What's the current fix to this?

  5. bashtage commented on May 20, 2019

    @bashtage
    Member

    See #5759

  6. geethikabhavya commented on May 23, 2019

    @geethikabhavya

    Kindly let me know how to fix this - how do I downgrade scipy?

  7. MarvinT commented on May 24, 2019

    @MarvinT
    Author

    How did you install scipy? pip or conda?

  8. geethikabhavya commented on May 24, 2019

    @geethikabhavya
  9. added a commit that references this issue on May 27, 2019
  10. SachitNayak commented on Jun 8, 2019

    @SachitNayak

    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?

  11. bashtage commented on Jun 8, 2019

    @bashtage
    Member
  12. SachitNayak commented on Jun 11, 2019

    @SachitNayak

    @bashtage Thank you so much!

  13. clemenspeters commented on Jun 18, 2019

    @clemenspeters

    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

  14. ybenita1234 commented on Jun 18, 2019

    @ybenita1234

    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.

  15. jorellano commented on Jul 21, 2019

    @jorellano

    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

    Thank you. works now

  16. avitomar12 commented on Apr 24, 2020

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

    Thanks @bashtage
    Worked for me.

  17. bashtage commented on Apr 24, 2020

    @bashtage
    Member

    @avitomar12 You should use the latest release. Just pip install statsmodels --upgrade.

  18. avitomar12 commented on Apr 24, 2020

    @avitomar12

    @bashtage thanks
    Yeah It worked. I used this in another machine.

  19. srivats0603 commented on Apr 28, 2020

    @srivats0603

    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

  20. tknows20 commented on Jul 29, 2020

    @tknows20
  21. Manuelhrokr commented on Sep 2, 2022

    @Manuelhrokr

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions