Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
non-one opened this issue Oct 14, 2021 · 9 comments
Open

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

non-one opened this issue Oct 14, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@non-one
Copy link

non-one commented Oct 14, 2021

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...

@lhenry15 lhenry15 added the bug Something isn't working label Oct 14, 2021
@lhenry15 lhenry15 self-assigned this Oct 14, 2021
@eunseokyang
Copy link

Downgrade keras to 2.4.0

@Jessica-jia
Copy link

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
Copy link

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
Copy link

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
Copy link
Collaborator

guanchuwang commented Dec 7, 2021 via email

@alisha-metkari-aera
Copy link

Downgrade keras to 2.4.0

tried this but getting error AttributeError: ISOLATION_FOREST

@rbeber
Copy link

rbeber commented Jan 25, 2022

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
Copy link
Collaborator

guanchuwang commented Jan 25, 2022 via email

@rbeber
Copy link

rbeber commented Jan 25, 2022

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'
>>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants