【问题标题】:Error importing pmdarima.arima library in Python在 Python 中导入 pmdarima.arima 库时出错
【发布时间】:2019-12-01 18:31:26
【问题描述】:

在尝试为 Python 导入 pmdarima.arima 库时,有人可以帮我解决以下错误消息吗?

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-6858fadc5169>", line 1, in <module>
    from pmdarima.arima import auto_arima
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/__init__.py", line 45, in <module>
    from .arima import auto_arima, ARIMA, AutoARIMA
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/arima/__init__.py", line 6, in <module>
    from .arima import *
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/arima/arima.py", line 10, in <module>
    from sklearn.metrics import mean_absolute_error, mean_squared_error
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/metrics/__init__.py", line 7, in <module>
    from .ranking import auc
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 35, in <module>
    from ..preprocessing import label_binarize
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/__init__.py", line 6, in <module>
    from ._function_transformer import FunctionTransformer
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_function_transformer.py", line 5, in <module>
    from ..utils.testing import assert_allclose_dense_sparse
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/utils/testing.py", line 718, in <module>
    import pytest
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pytest.py", line 13, in <module>
    from _pytest.fixtures import fixture, yield_fixture
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 842, in <module>
    class FixtureFunctionMarker(object):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker
    params = attr.ib(convert=attr.converters.optional(tuple))
TypeError: attrib() got an unexpected keyword argument 'convert'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 1101, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 319, in wrapped
    return f(*args, **kwargs)
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 353, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 1490, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 1448, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 733, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 195, in __getattribute__
    return getattr(getmod(), name)
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 179, in getmod
    x = importobj(modpath, None)
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 69, in importobj
    module = __import__(modpath, None, None, ['__doc__'])
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pytest.py", line 13, in <module>
    from _pytest.fixtures import fixture, yield_fixture
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 842, in <module>
    class FixtureFunctionMarker(object):
  File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker
    params = attr.ib(convert=attr.converters.optional(tuple))
TypeError: attrib() got an unexpected keyword argument 'convert'

【问题讨论】:

    标签: python pyramid-arima


    【解决方案1】:

    我搜索了最后出现的类型错误,这导致我遇到了一个相关的 StackOverflow 问题,其答案表明 pytest 的过时版本会导致问题。我已经升级了pytest 的版本,解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-03
      • 2017-09-15
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 2018-09-15
      • 2020-06-23
      • 1970-01-01
      相关资源
      最近更新 更多