Replicable-MARL / MARLlib

One repository is all that is necessary for Multi-agent Reinforcement Learning (MARL)
https://marllib.readthedocs.io
MIT License
930 stars 148 forks source link

Whether it can be deployed on Windows #53

Closed mate-huaboy closed 2 years ago

mate-huaboy commented 2 years ago

Hi,Thank you very much for your work, which has inspired me a lot, but I still have some questions .

first,I want to deploy this project on Windows, but there are some errors, The error at mul_manager = multiprocessing.manager () in marl\algos\utils\centralized_critic_hetero.py will look like the following:

d:\廖文华\code\MARLlib
Backend TkAgg is interactive backend. Turning interactive mode on.
d:\廖文华\code\MARLlib
Backend TkAgg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "d:\廖文华\code\MARLlib\marl\main.py", line 9, in <module>
    from marl.algos.run_il import run_il
  File "d:\廖文华\code\MARLlib\marl\algos\run_il.py", line 15, in <module>
    from marl.algos.scripts import POlICY_REGISTRY
  File "d:\廖文华\code\MARLlib\marl\algos\scripts\__init__.py", line 13, in <module>
    from marl.algos.scripts.happo import run_happo
  File "d:\廖文华\code\MARLlib\marl\algos\scripts\happo.py", line 4, in <module>
    from marl.algos.core.CC.happo import HAPPOTrainer
  File "d:\廖文华\code\MARLlib\marl\algos\core\CC\happo.py", line 24, in <module>
    from marl.algos.utils.centralized_critic_hetero import (
  File "d:\廖文华\code\MARLlib\marl\algos\utils\centralized_critic_hetero.py", line 16, in <module>
    mul_manager = multiprocessing.Manager()
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\context.py", line 57, in Manager
    m.start()
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\managers.py", line 579, in start
    self._process.start()
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "C:\ProgramData\Anaconda3\envs\muti_agent\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

I dont kown why and how to solve it,could you please give me some advice.

second,could you please show your pip list or conda list?I want to see some lib's version in your project ,thanks!!!

mrvgao commented 2 years ago

@mate-huaboy thanks for your comments. Because this project is developed and deployed on the Linux system, and have not run this project on any windows env. It is possible that occurs some issues in the Windows environment.

But fortunately, I find there is a similar issue in Stack Overflow, which occurs in windows env too; this may help you: https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing

mrvgao commented 2 years ago

Besides, the whole pip list (requirements) will be added to this project doc, which will be published soon.