Kats throw an error module 'packaging.version' has no attribute 'LegacyVersion'
KansaiUser opened this issue · comments
KansaiUser commented
This is the first time using Kats
I tried to use it with python 3.6 but it threw an error
future feature annotations is not defined
so instead I used python 3.9 and now when I do
from kats.detectors.outlier import OutlierDetector
outlier_detector = OutlierDetector(ts_day, "additive")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[19], line 1
----> 1 from kats.detectors.outlier import OutlierDetector
3 outlier_detector = OutlierDetector(ts_day, "additive")
File ~/miniconda3/envs/data_analysisPy39/lib/python3.9/site-packages/kats/__init__.py:6
1 # Copyright (c) Meta Platforms, Inc. and affiliates.
2 #
3 # This source code is licensed under the MIT license found in the
4 # LICENSE file in the root directory of this source tree.
----> 6 from . import compat # noqa # usort: skip
7 from . import consts # noqa # usort: skip
8 from . import data # noqa # usort: skip
File ~/miniconda3/envs/data_analysisPy39/lib/python3.9/site-packages/kats/compat/__init__.py:6
1 # Copyright (c) Meta Platforms, Inc. and affiliates.
2 #
3 # This source code is licensed under the MIT license found in the
4 # LICENSE file in the root directory of this source tree.
----> 6 from . import compat # noqa # usort: skip
7 from . import pandas # noqa # usort: skip
8 from . import statsmodels # noqa # usort: skip
File ~/miniconda3/envs/data_analysisPy39/lib/python3.9/site-packages/kats/compat/compat.py:19
14 from typing import Callable, Union
16 from packaging import version as pv
---> 19 V = Union[str, "Version", pv.Version, pv.LegacyVersion]
22 class Version:
23 """Extend packaging Version to allow comparing to version strings.
24
25 Wraps instead of extends, because pv.parse can return either a
26 pv.Version or a pv.LegacyVersion.
27 """
AttributeError: module 'packaging.version' has no attribute 'LegacyVersion'
How can I be able to use kats for that simple thing, without an error?
cbergmeir commented
Hi, I'm also new to Kats and ran into the same issue. It is caused by a wrong version of the "packaging" package. I was able to fix it with: conda install packaging=21.3