简体   繁体   中英

Error importing pmdarima.arima library in Python

Can someone help me resolve the following error message when trying to import the pmdarima.arima library for Python?

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'

I searched up the type error that appears at the end, which led me to a related StackOverflow question whose answer suggested an outdated version of pytest would cause issues. I've since upgraded my version of pytest which resolved my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM