IntelLabs / coach

Reinforcement Learning Coach by Intel AI Lab enables easy experimentation with state of the art Reinforcement Learning algorithms
https://intellabs.github.io/coach/
Apache License 2.0
2.33k stars 461 forks source link

Cannot import minio.error ResponseError #472

Closed HYDesmondLiu closed 3 years ago

HYDesmondLiu commented 3 years ago

Hi experts, I just refer to the tutorials and found this error running it. Do I must have minio working to use Coach RL? May I know how do I solve this? Is it only for visualization? What lines could I remove to make it work?

Environment:

Traceback (most recent call last):
  File "batch_rl.py", line 13, in <module>
    from rl_coach.agents.ddqn_bcq_agent import DDQNBCQAgentParameters, KNNParameters
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/agents/ddqn_bcq_agent.py", line 25, in <module>
    from rl_coach.graph_managers.batch_rl_graph_manager import BatchRLGraphManager
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/graph_managers/batch_rl_graph_manager.py", line 26, in <module>
    from rl_coach.graph_managers.graph_manager import ScheduleParameters
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/graph_managers/graph_manager.py", line 35, in <module>
    from rl_coach.data_stores.data_store_impl import get_data_store as data_store_creator
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/data_stores/data_store_impl.py", line 19, in <module>
    from rl_coach.data_stores.s3_data_store import S3DataStore, S3DataStoreParameters
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/data_stores/s3_data_store.py", line 21, in <module>
    from minio.error import ResponseError
ImportError: cannot import name 'ResponseError'

from minio.error import ResponseError
ImportError: cannot import name 'ResponseError'
HYDesmondLiu commented 3 years ago

It seems like minio has changed their class name from 'ResponseError' to 'InvalidResponseError'. I have to manually modify the ones in _s3_datastore.py......

HYDesmondLiu commented 3 years ago

OK, then now I got this. Is it that you developed code based on TenforFlow 1.X version? AFAIK, Tensorflow modified a lot of APIs migrating from V1 to V2.

Traceback (most recent call last):
  File "batch_rl.py", line 87, in <module>
    graph_manager.create_graph(task_parameters)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/graph_managers/graph_manager.py", line 148, in create_graph
    self.level_managers, self.environments = self._create_graph(task_parameters)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/graph_managers/batch_rl_graph_manager.py", line 152, in _create_graph
    spaces_definition=self.spaces_definition)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/level_manager.py", line 91, in __init__
    self.build(spaces_definition)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/level_manager.py", line 165, in build
    [agent.set_environment_parameters(spaces) for agent in self.agents.values()]
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/level_manager.py", line 165, in <listcomp>
    [agent.set_environment_parameters(spaces) for agent in self.agents.values()]
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/agents/agent.py", line 335, in set_environment_parameters
    self.init_environment_dependent_modules()
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/agents/value_optimization_agent.py", line 46, in init_environment_dependent_modules
    super().init_environment_dependent_modules()
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/agents/agent.py", line 380, in init_environment_dependent_modules
    self.networks = self.create_networks()
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/agents/agent.py", line 353, in create_networks
    worker_device=self.worker_device)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/architectures/network_wrapper.py", line 86, in __init__
    network_is_trainable=True)
  File "/home/hsinyu/hyliu_Python/lib/python3.6/site-packages/rl_coach/architectures/tensorflow_components/general_network.py", line 71, in construct
    with tf.variable_scope(variable_scope, auxiliary_name_scope=True) as vs:
AttributeError: module 'tensorflow' has no attribute 'variable_scope'
HYDesmondLiu commented 3 years ago

Alright I have tried to replace all the v2 behavior with v1 but it is exhaustive. Would you please let me know if using the following works or not or I need to downgrade my TensorFlow version?

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
HYDesmondLiu commented 3 years ago

OK, I finally found the solution:

  1. Install TensorFlow with 1.7.0 (<1.7.0 the hub is not working)
  2. modify the minio class name.

Please make quick fix if possible to benefit others so they do not need to suffer like me.

HYDesmondLiu commented 3 years ago

Is anyone still maintaining this Github page? Just curious......

mail2surie commented 3 years ago

Hi, I am facing the same issue. seems like the issue is not yet fixed. may I know what changes did you do to overcome this issue..

smart-patrol commented 3 years ago

I've gotten the same error. Possibly related to how coach is only supported for Ubuntu 16? Running 18 as well.

Edit:

I got it to work.

I went back and used Ubuntu 16 with Python 3.5. I followed the install steps as listed and then also ran the installs here.

Real shame that this lib went into maintenance.