crowdAI / marLo

Multi Agent Reinforcement Learning using MalmÖ
MIT License
245 stars 46 forks source link

A problem about examples/multiagent_chainer_test_DQN.py #26

Closed magic3007 closed 5 years ago

magic3007 commented 6 years ago

When running examples/multiagent_chainer_test_DQN.py, I encountered an exception at line 68:

Traceback (most recent call last):
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2299, in resolve
    return functools.reduce(getattr, self.attrs, module)
AttributeError: module 'marlo.envs' has no attribute 'MinecraftEnv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "multiagent_chainer_test_DQN.py", line 73, in <module>
    env = marlo.make(env_name)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\marlo\__init__.py", line 89, in make
    env = gym.make(env_key)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 167, in make
    return registry.make(id)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 119, in make
    env = spec.make()
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 85, in make
    cls = load(self._entry_point)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 14, in load
    result = entry_point.load(False)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
    return self.resolve()
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 2301, in resolve
    raise ImportError(str(exc))
ImportError: module 'marlo.envs' has no attribute 'MinecraftEnv'

To solve this problem, I tried to compare this file with those in marlo.envs. I modified this file as following(Line 66-71):

register(
    id=env_name,
    entry_point='marlo.envs:MazeRunner.MarloEnvBuilder',
    # Make sure mission xml is in the marlo/assets directory.
    kwargs={'mission_file': args.mission_file}
)

However, I came across another exception:

Traceback (most recent call last):
  File "multiagent_chainer_test_DQN.py", line 73, in <module>
    env = marlo.make(env_name)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\marlo\__init__.py", line 89, in make
    env = gym.make(env_key)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 167, in make
    return registry.make(id)
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 119, in make
    env = spec.make()
  File "C:\Users\maiji\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py", line 86, in make
    env = cls(**self._kwargs)
TypeError: __init__() got an unexpected keyword argument 'mission_file'

It seemed that we need to know the specified meanings of register and its parameters. I wonder if you could explain this file in detail, especially the meaning of the parameters?

spMohanty commented 6 years ago

@magic3007 : It looks like you are using an older version of marLo.

Can you try installing the latest version using :

pip3 install -U marLo
spMohanty commented 6 years ago

@magic3007 : Also, I realised the chainer examples arent updated properly yet. To get started, I would recommend to just try out the simple singleagent and the multiagent examples.

magic3007 commented 6 years ago

@spMohanty I am trying to show you my previous experience: I used to install marlo by

pip3 install -U marLo

Right after that, I run examples/multiagent_chainer_test_DQN.py, but an exception happened:

Traceback (most recent call last):
  File "multiagent_chainer_test_DQN.py", line 25, in <module>
    from marlo.multiagent import start_agents
ModuleNotFoundError: No module named 'marlo.multiagent'

I was considering that maybe it wasn't the latest version. Actually, I found marlo/multiagent.pyon github:

https://github.com/crowdAI/marLo/commit/1ab1a179382ad4b3cd15dfaea3f624b49b26256d

Maybe the version installed by pip3 isn't the latest?

idvhfd commented 5 years ago

The examples should have been updated on Master already. Closing this until further notice.

biggzlar commented 5 years ago

I'm having several issues with the examples.