yhat / ggpy

ggplot port for python
http://yhat.github.io/ggpy/
BSD 2-Clause "Simplified" License
3.7k stars 573 forks source link

ImportError: cannot import name 'getargspec' #611

Open qhzhang87 opened 7 years ago

qhzhang87 commented 7 years ago

I cannot import the package, have the following error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-54-1140326dc452> in <module>()
----> 1 from ggplot import *

~/anaconda/lib/python3.6/site-packages/ggplot/__init__.py in <module>()
     18 
     19 from .geoms import geom_area, geom_blank, geom_boxplot, geom_line, geom_point, geom_jitter, geom_histogram, geom_density, geom_hline, geom_vline, geom_bar, geom_abline, geom_tile, geom_rect, geom_bin2d, geom_step, geom_text, geom_path, geom_ribbon, geom_now_its_art, geom_violin, geom_errorbar, geom_polygon
---> 20 from .stats import stat_smooth, stat_density
     21 
     22 from .facets import facet_wrap, facet_grid, Facet

~/anaconda/lib/python3.6/site-packages/ggplot/stats/__init__.py in <module>()
      1 from .stat_density import stat_density
----> 2 from .stat_smooth import stat_smooth

~/anaconda/lib/python3.6/site-packages/ggplot/stats/stat_smooth.py in <module>()
      3 
      4 from ..geoms.geom import geom
----> 5 from . import smoothers
      6 from ..utils import is_date
      7 

~/anaconda/lib/python3.6/site-packages/ggplot/stats/smoothers.py in <module>()
      4 from pandas.lib import Timestamp
      5 import pandas as pd
----> 6 import statsmodels.api as sm
      7 from statsmodels.nonparametric.smoothers_lowess import lowess as smlowess
      8 from statsmodels.sandbox.regression.predstd import wls_prediction_std

~/anaconda/lib/python3.6/site-packages/statsmodels/api.py in <module>()
      3 from . import tools
      4 from .tools.tools import add_constant, categorical
----> 5 from . import regression
      6 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      7 from .regression.recursive_ls import RecursiveLS

~/anaconda/lib/python3.6/site-packages/statsmodels/regression/__init__.py in <module>()
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels import NoseWrapper as Tester
      4 test = Tester().test

~/anaconda/lib/python3.6/site-packages/statsmodels/regression/linear_model.py in <module>()
     51                                           cache_readonly,
     52                                           cache_writable)
---> 53 import statsmodels.base.model as base
     54 import statsmodels.base.wrapper as wrap
     55 from statsmodels.emplike.elregress import _ELRegOpts

~/anaconda/lib/python3.6/site-packages/statsmodels/base/model.py in <module>()
      8 from statsmodels.stats.contrast import ContrastResults, WaldTestResults
      9 from statsmodels.tools.decorators import resettable_cache, cache_readonly
---> 10 import statsmodels.base.wrapper as wrap
     11 from statsmodels.tools.numdiff import approx_fprime
     12 from statsmodels.tools.sm_exceptions import ValueWarning, \

~/anaconda/lib/python3.6/site-packages/statsmodels/base/wrapper.py in <module>()
      3 
      4 import numpy as np
----> 5 from statsmodels.compat.python import get_function_name, iteritems, getargspec
      6 
      7 class ResultsWrapper(object):

ImportError: cannot import name 'getargspec'
Michael-E-Rose commented 7 years ago

I had the same error. Upgrading statsmodels solved the issue:

pip install statsmodels --upgrade

chloechen1995 commented 6 years ago

I also encountered the same issue. I did the upgrade as suggested above. However, I still have the same error. I am using Jupyter notebook with Python 2.0 on a mac. Any suggestion? Thanks in advance.

anishmahapatra commented 6 years ago

I'm having the same problem on Jupyter Notebooks, any advice? I'm running Python 2.7 with statsmodels 0.8.0

SaulAryehKohn commented 6 years ago

For whatever reason, this error is only occurring in my Jupyter notebook. Upgraded to the most recent version of statsmodels on Python 2.7. The command:

from statsmodels.tsa.arima_model import ARIMA

@qhzhang87 's error in Jupyter, but successfully imports with errors in a .py script or within the Python terminal:

Python 2.7.13 |Anaconda custom (x86_64)| (default, Dec 20 2016, 23:05:08) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from statsmodels.tsa.arima_model import ARIMA
//anaconda/envs/py27/lib/python2.7/site-packages/pandas/core/computation/__init__.py:18: UserWarning: The installed version of numexpr 2.4.4 is not supported in pandas and will be not be used
The minimum supported version is 2.4.6

  ver=ver, min_ver=_MIN_NUMEXPR_VERSION), UserWarning)
//anaconda/envs/py27/lib/python2.7/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
  from pandas.core import datetools
>>> 
pointOfive commented 6 years ago

EDIT: solved by restarting kernel :)

Piling on here :)

Ran pip install statsmodels --upgrade; then, from statsmodels.stats.outliers_influence import variance_inflation_factor in both command line and jupyter notebook... runs in python, but not in jupyter notebook...


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-109-d8fbd8280798> in <module>()
----> 1 from statsmodels.stats.outliers_influence import variance_inflation_factor

/anaconda2/lib/python2.7/site-packages/statsmodels/stats/outliers_influence.py in <module>()
     11 import numpy as np
     12 
---> 13 from statsmodels.regression.linear_model import OLS
     14 from statsmodels.tools.decorators import cache_readonly
     15 from statsmodels.stats.multitest import multipletests

/anaconda2/lib/python2.7/site-packages/statsmodels/regression/__init__.py in <module>()
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels import PytestTester
      4 test = PytestTester()
      5 

/anaconda2/lib/python2.7/site-packages/statsmodels/regression/linear_model.py in <module>()
     46                                           cache_readonly,
     47                                           cache_writable)
---> 48 import statsmodels.base.model as base
     49 import statsmodels.base.wrapper as wrap
     50 from statsmodels.emplike.elregress import _ELRegOpts

/anaconda2/lib/python2.7/site-packages/statsmodels/base/model.py in <module>()
      6 from statsmodels.tools.data import _is_using_pandas
      7 from statsmodels.tools.tools import recipr, nan_dot
----> 8 from statsmodels.stats.contrast import (ContrastResults, WaldTestResults,
      9                                         t_test_pairwise)
     10 from statsmodels.tools.decorators import resettable_cache, cache_readonly

ImportError: cannot import name t_test_pairwise
Seal1026 commented 3 years ago

from statsmodels.stats.outliers_influence import variance_inflation_factor

Thank you so much! solved