datamllab / tods

TODS: An Automated Time-series Outlier Detection System
http://tods-doc.github.io
Apache License 2.0
1.41k stars 192 forks source link

Run demo Error: ImportError: cannot import name 'get_config' #46

Open non-one opened 2 years ago

non-one commented 2 years ago

my env python 3.6.9 pip 21.3 use virtualenv and create a pure env

I install tods successfully, but run demo has some trouble, detail as follow:


$ python test.py
/home/uba/ML_env/tods/env/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.preprocessing.data module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.preprocessing. Anything that cannot be imported from sklearn.preprocessing is now part of the private API.
  warnings.warn(message, FutureWarning)
/home/uba/ML_env/tods/env/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.decomposition.truncated_svd module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.decomposition. Anything that cannot be imported from sklearn.decomposition is now part of the private API.
  warnings.warn(message, FutureWarning)
Traceback (most recent call last):
  File "test.py", line 3, in <module>
    from tods import schemas as schemas_utils
  File "/home/uba/ML_env/tods/tods/__init__.py", line 5, in <module>
    from tods.detection_algorithm import *
  File "/home/uba/ML_env/tods/tods/detection_algorithm/__init__.py", line 2, in <module>
    from tods.detection_algorithm.DeepLog import DeepLogPrimitive
  File "/home/uba/ML_env/tods/tods/detection_algorithm/DeepLog.py", line 10, in <module>
    from keras.models import Sequential
  File "/home/uba/ML_env/tods/env/lib/python3.6/site-packages/keras/__init__.py", line 25, in <module>
    from keras import models
  File "/home/uba/ML_env/tods/env/lib/python3.6/site-packages/keras/models.py", line 19, in <module>
    from keras import backend
  File "/home/uba/ML_env/tods/env/lib/python3.6/site-packages/keras/backend.py", line 36, in <module>
    from tensorflow.python.eager.context import get_config
ImportError: cannot import name 'get_config'

I find a solution but haven't been tested:

Replace all import keras with from tensorflow import keras which is really a hard work...

eunseokyang commented 2 years ago

Downgrade keras to 2.4.0

Jessica-jia commented 2 years ago

try this,it works for me. step 1: pip install keras==2.3.1 step 2: pip install git+https://www.github.com/keras-team/keras-contrib.git

AlexMV12 commented 2 years ago

I can't install tods due to this problem.

To reproduce the issue, you can build this Docker image:

FROM python:3.6.15-bullseye
RUN apt update
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y libssl-dev libcurl4-openssl-dev libyaml-dev build-essential libopenblas-dev libcap-dev ffmpeg git
RUN git clone https://github.com/datamllab/tods.git
WORKDIR tods
RUN pip install -e .
RUN python3 -c "from tods import schemas as schemas_utils"
alisha-metkari-aera commented 2 years ago

try this,it works for me. step 1: pip install keras==2.3.1 step 2: pip install git+https://www.github.com/keras-team/keras-contrib.git

tried this but getting error AttributeError: ISOLATION_FOREST . Can anyone help?

guanchuwang commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。I've received your mail. 

alisha-metkari-aera commented 2 years ago

Downgrade keras to 2.4.0

tried this but getting error AttributeError: ISOLATION_FOREST

rbeber commented 2 years ago

Downgrade keras to 2.4.0

tried this and worked for me, only future warnings


>>> import tods
/home/matteo/miniforge3/envs/tods_times/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.preprocessing.data module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.preprocessing. Anything that cannot be imported from sklearn.preprocessing is now part of the private API.
  warnings.warn(message, FutureWarning)
/home/matteo/miniforge3/envs/tods_times/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.decomposition.truncated_svd module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.decomposition. Anything that cannot be imported from sklearn.decomposition is now part of the private API.
  warnings.warn(message, FutureWarning)
Using TensorFlow backend.
d3m.primitives.tods.detection_algorithm.LSTMODetector: Primitive is not providing a description through its docstring.
>>>
'''
guanchuwang commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。I've received your mail. 

rbeber commented 2 years ago

Downgrade keras to 2.4.0

tried this and worked for me, only future warnings

>>> import tods
/home/matteo/miniforge3/envs/tods_times/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.preprocessing.data module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.preprocessing. Anything that cannot be imported from sklearn.preprocessing is now part of the private API.
  warnings.warn(message, FutureWarning)
/home/matteo/miniforge3/envs/tods_times/lib/python3.6/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.decomposition.truncated_svd module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.decomposition. Anything that cannot be imported from sklearn.decomposition is now part of the private API.
  warnings.warn(message, FutureWarning)
Using TensorFlow backend.
d3m.primitives.tods.detection_algorithm.LSTMODetector: Primitive is not providing a description through its docstring.
>>>
'''

However when I try the second demo displayed in the readme, at the line:

 search = BruteForceSearch(problem_description=problem_description,backend=backend)

I get the following error:

>>> search = BruteForceSearch(problem_description=problem_description,backend=backend)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/matteo/repos/tods/tods/searcher/brute_force_search.py", line 20, in __init__
    self.task_description['task_type'], self.task_description['task_subtype'], self.task_description['data_types'])
  File "/home/matteo/repos/tods/tods/searcher/brute_force_search.py", line 73, in _return_pipelines
    pipeline_candidates = _generate_pipelines(primitive_python_paths)
  File "/home/matteo/repos/tods/tods/searcher/brute_force_search.py", line 276, in _generate_pipelines
    return _generate_pipline(combinations)
  File "/home/matteo/repos/tods/tods/searcher/brute_force_search.py", line 194, in _generate_pipline
    step_0 = PrimitiveStep(primitive=index.get_primitive('d3m.primitives.data_transformation.dataset_to_dataframe.Common'))
  File "/home/matteo/miniforge3/envs/tods_times/lib/python3.6/site-packages/d3m/index.py", line 115, in get_primitive
    module = importlib.import_module(path)
  File "/home/matteo/miniforge3/envs/tods_times/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'd3m.primitives.data_transformation'
>>>