minerllabs / minerl

MineRL Competition for Sample Efficient Reinforcement Learning - Python Package
http://minerl.io/docs/
Other
711 stars 153 forks source link

AttributeError: 'socket' object has no attribute 'client_socket_send_message' #606

Closed dotada closed 1 year ago

dotada commented 2 years ago

I just got started with minerl and wanted to visualize the agent and followed the instructions on https://minerl.readthedocs.io/en/latest/tutorials/minerl_tools.html#visualizing-the-data-minerl-viewer, but when I try to run minerl.interactor I get

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
2021-12-08 21:38:56    return _run_code(code, main_globals, None,
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\interactor\__main__.py", line 80, in <module>
    run_interactor(ip=opts.ip, port=opts.port)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\interactor\__main__.py", line 56, in run_interactor
    request_interactor(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\interactor\__main__.py", line 23, in request_interactor
    _MultiAgentEnv._TO_MOVE_hello(sock)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\_multiagent.py", line 792, in _TO_MOVE_hello
 Naix-gateway minerl.env.malmo[29996] INFO Logging output of Minecraft to .\logs\mc_22415.log
    instance.client_socket_send_message(("<MalmoEnv" + malmo_version + "/>").encode())
AttributeError: 'socket' object has no attribute 'client_socket_send_message'
Miffyli commented 2 years ago

Install pip install minerl==0.3.7. Interactor does not work with the newest version sadly.

dotada commented 2 years ago

Install pip install minerl==0.3.7. Interactor does not work with the newest version sadly.

I already tried that, whenever I try to run a script with that version the build always fails

C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\minerl folder\bot.py", line 6, in <module>
    env = gym.make("MineRLObtainDiamondDense-v0")  # A MineRLObtainDiamondDense-v0 env
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 184, in make
    return registry.make(id, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 106, in make
    env = spec.make(**kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 76, in make
    env = cls(**_kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\core.py", line 137, in __init__
    self.instance = self._get_new_instance(port)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\core.py", line 159, in _get_new_instance
    instance.launch()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\malmo.py", line 485, in launch
    self.watcher_process, update_port = self._launch_process_watcher(
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\malmo.py", line 706, in _launch_process_watcher
    p.start()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\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.
Traceback (most recent call last):
  File "D:\minerl folder\bot.py", line 6, in <module>
    env = gym.make("MineRLObtainDiamondDense-v0")  # A MineRLObtainDiamondDense-v0 env
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 184, in make
    return registry.make(id, **kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 106, in make
    env = spec.make(**kwargs)
  File "C:\Users\User\AppData\Roaming\Python\Python39\site-packages\gym\envs\registration.py", line 76, in make
    env = cls(**_kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\core.py", line 137, in __init__
    self.instance = self._get_new_instance(port)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\core.py", line 159, in _get_new_instance
    instance.launch()
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\minerl\env\malmo.py", line 513, in launch
    raise EOFError(error_str + "\n\nMinecraft process finished unexpectedly. There was an error with Malmo.")
EOFError: This mapping 'snapshot_20161220' was designed for MC 1.11! Use at your own peril.
#################################################
         ForgeGradle 2.2-SNAPSHOT-8de58cf
  https://github.com/MinecraftForge/ForgeGradle
#################################################
               Powered by MCP unknown
             http://modcoderpack.com
         by: Searge, ProfMobius, Fesh0r,
         R4wk, ZeuX, IngisKahn, bspkrs
#################################################
Found AccessTransformer: malmomod_at.cfg
:deobfCompileDummyTask
:deobfProvidedDummyTask
:getVersionJson
:extractUserdev UP-TO-DATE
:downloadClient SKIPPED
:downloadServer SKIPPED
:splitServerJar SKIPPED
:mergeJars SKIPPED
:applyBinaryPatches SKIPPED
:extractDependencyATs SKIPPED
:extractMcpData SKIPPED
:extractMcpMappings SKIPPED
:genSrgs SKIPPED
:deobfMcMCP UP-TO-DATE
:sourceApiJava UP-TO-DATE
:compileApiJava UP-TO-DATE
:processApiResources UP-TO-DATE
:apiClasses UP-TO-DATE
:copyModToClient UP-TO-DATE
:copyModToServer UP-TO-DATE
:copySrg UP-TO-DATE
:deleteSchemas
:copySchemas
:jaxb UP-TO-DATE
:sourceMainJava UP-TO-DATE
:compileJava
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':forgeGradleMc'.
> Could not find net.minecraftforge:forgeBin:1.11.2-13.20.1.2588-PROJECT(Minecraft).
  Searched in the following locations:
      https://maven.minecraftforge.net/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      https://maven.minecraftforge.net/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      https://repo1.maven.org/maven2/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      https://repo1.maven.org/maven2/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      https://libraries.minecraft.net/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      https://libraries.minecraft.net/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      https://repo.spongepowered.org/maven/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      https://repo.spongepowered.org/maven/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      https://jitpack.io/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      https://jitpack.io/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      file:/C:/Users/User/.gradle/caches/minecraft/deobfedDeps/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).pom
      file:/C:/Users/User/.gradle/caches/minecraft/deobfedDeps/net/minecraftforge/forgeBin/1.11.2-13.20.1.2588-PROJECT(Minecraft)/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      file:/C:/Users/User/AppData/Local/Programs/Python/Python39/Lib/site-packages/minerl/env/Malmo/Minecraft/.gradle/minecraft/forgeBin-1.11.2-13.20.1.2588-PROJECT(Minecraft).jar
      file:/C:/Users/User/AppData/Local/Programs/Python/Python39/Lib/site-packages/minerl/env/Malmo/Minecraft/.gradle/minecraft/forgeBin.jar
  Required by:
      com.microsoft.MalmoMod:Minecraft:0.37.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 17.812 secs

Minecraft process finished unexpectedly. There was an error with Malmo.
Miffyli commented 2 years ago

Hmm sounds like one of the repositories might be broken again :/. Try installing it again later (can not do much about it).

Miffyli commented 2 years ago

Never mind. For me the MineRL 0.3.7 is running correctly but I might have cached files. Try this fix:

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.
dotada commented 2 years ago

Never mind. For me the MineRL 0.3.7 is running correctly but I might have cached files. Try this fix:

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.

May I ask where am I supposed to place this since I'm fairly new to python.

Miffyli commented 2 years ago

Do not put any of the code on the 0th indent level (e.g. put all the code inside functions), and in the end of code have this:

if __name__ == '__main__':
    main()

where main() contains the main part of your code.

dotada commented 2 years ago

if name == 'main': main()

Build still fails

Miffyli commented 2 years ago

Ok, repo might be down in that case. You should try again tomorrow.

dotada commented 2 years ago

Ok, repo might be down in that case. You should try again tomorrow.

Alright.

dotada commented 2 years ago

It's been a day and it still isn't quite working. Gonna try again in a few hours.

Miffyli commented 2 years ago

To avoid spamming github issues with short messages, please join the MineRL discord to further discuss this: https://discord.com/invite/BT9uegr (at the same time we can see if others have the same issue). :)