Skip to content

statsmodels-0.9.0: No module named 'numpy' #4651

Closed

Description

@haber-he

Collecting statsmodels>=0.8.0 (from -r requirements.txt (line 15))
Downloading https://files.pythonhosted.org/packages/67/68/eb3ec6ab61f97216c257edddb853cc174cd76ea44b365cf4adaedcd44482/statsmodels-0.9.0.tar.gz (12.7MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-hferqxy1/statsmodels/setup.py", line 347, in
from numpy.distutils.misc_util import get_info
ImportError: No module named 'numpy'

----------------------------------------

�[91mCommand "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hferqxy1/statsmodels/

Activity

  1. Thomasillo commented on May 17, 2018

    @Thomasillo

    Same for me

  2. jbrockmendel commented on May 17, 2018

    @jbrockmendel
    Contributor

    Similar 0.9.0 installation issues:

    • running tox on a package that has statsmodels as a dependency raises the numpy error in the OP.
    • python3 on ubuntu 16 pip3 install goes through OK but on import raises ImportError: cannot import name '_representation' (no such problem on py2) (this occurs both with and without tox)
  3. matthew-brett commented on May 18, 2018

    @matthew-brett
    Contributor

    Hi. Try again now? I am hoping that the wheels will have fixed the install problems.

    You will still need to install numpy and scipy and pandas in order for statsmodels to import correctly.

    For reference the numpy error is because the numpy package is a build-time dependency of statsmodels. Funnily enough, ImportError: cannot import name '_representation , is because of a hidden build-time dependency on Scipy. That is, if you want to install statsmodels from source, you need scipy installed already, and if you don't, statsmodels builds incorrectly.

  4. zertrin commented on May 21, 2018

    @zertrin

    Note: On Linux, this works for Python 3.5 and 3.6 but not for 3.4 because there is no Linux cp34 wheel for statsmodels 0.9.0 (version 0.8.0 had Linux wheels for py34).

    Consequently, cannot use requirements.txt with statsmodels for py34 as of version 0.9.0.

    A workaround for requirements.txt is to pin the statsmodels version for py3.4 to something before 0.9.0:

    statsmodels; python_version >= '3.5'
    statsmodels<0.9; python_version == '3.4'
    
  5. matthew-brett commented on May 21, 2018

    @matthew-brett
    Contributor

    Yes, I'm sorry about that. Python 3.4 wheels are harder to test because Pandas requires Python3 >= 3.5 : https://github.com/pandas-dev/pandas/blob/0.23.x/setup.py#L751

  6. zertrin commented on May 21, 2018

    @zertrin

    As a matter of fact, this is part of my requirements_dev.txt now 😉

    numpy
    pandas; python_version >= '3.5'
    pandas<0.21; python_version == '3.4'
    scipy
    statsmodels; python_version >= '3.5'
    statsmodels<0.9; python_version == '3.4'
    
  7. added 4 commits that reference this issue on Aug 21, 2018
    708d390
    72cb33b
    a0c5373
    6b0302f
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