Cannot make env successfully every time

#1

Hello,

I fail to make env sometimes, but after I reboot my computer, I manage to do it. This is happening all the time.

One strange thing is that, although it fails to make env, the Minecraft game window is still jump out.

Another strange thing is that, there is still a runtime error, even if it manages to make env.

My devices:
Windows 7
CPU i5-7500
GPU Intel® HD Graphics 630 (no GPU)
Python 3.5.1 / Python 3.6.3 (Both of them meet the same condition)
JAVA 1.8.0_211

My codes are:

import minerl
import gym
import logging

logging.basicConfig(level=logging.DEBUG)

env = gym.make(‘MineRLNavigateDense-v0’)

obs, _ = env.reset()

done = False
while not done:
action = env.action_space.sample()

# One can also take a no_op action with
# action =env.action_space.noop()

obs, reward, done, info = env.step(action)
print(obs.keys(), type(reward), type(done), info.keys())

When it fails, the logs are:

INFO:minerl.env.malmo.instance.11d85b:Starting Minecraft process: [‘C:\Users\ADMINI~1\AppData\Local\Temp\tmpw2tu7nzr\Minecraft\launchClient.bat’, ‘-port’, ‘9001’, ‘-env’, ‘-runDir’, ‘C:\Users\ADMINI~1\AppData\Local\Temp\tmpw2tu7nzr\Minecraft\run’]
INFO:minerl.env.malmo.instance.11d85b:Starting process watcher for process 2356 @ localhost:9001
DEBUG:minerl.env.malmo.instance.11d85b:This mapping ‘snapshot_20161220’ was designed for MC 1.11! Use at your own peril.
DEBUG:minerl.env.malmo.instance.11d85b:#################################################
DEBUG:minerl.env.malmo.instance.11d85b: ForgeGradle 2.2-SNAPSHOT-3966cea
DEBUG:minerl.env.malmo.instance.11d85b: https://github.com/MinecraftForge/ForgeGradle
DEBUG:minerl.env.malmo.instance.11d85b:#################################################
DEBUG:minerl.env.malmo.instance.11d85b: Powered by MCP unknown
DEBUG:minerl.env.malmo.instance.11d85b: http://modcoderpack.com
DEBUG:minerl.env.malmo.instance.11d85b: by: Searge, ProfMobius, Fesh0r,
DEBUG:minerl.env.malmo.instance.11d85b: R4wk, ZeuX, IngisKahn, bspkrs
DEBUG:minerl.env.malmo.instance.11d85b:#################################################
DEBUG:minerl.env.malmo.instance.11d85b:Found AccessTransformer: malmomod_at.cfg
DEBUG:minerl.env.malmo.instance.11d85b::deobfCompileDummyTask
DEBUG:minerl.env.malmo.instance.11d85b::deobfProvidedDummyTask
DEBUG:minerl.env.malmo.instance.11d85b::getVersionJson
DEBUG:minerl.env.malmo.instance.11d85b::extractUserdev UP-TO-DATE
DEBUG:minerl.env.malmo.instance.11d85b::downloadClient SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::downloadServer SKIPPED
INFO:minerl.env.malmo.instance.2bc84f:Starting Minecraft process: [‘C:\Users\ADMINI~1\AppData\Local\Temp\tmpoch275nx\Minecraft\launchClient.bat’, ‘-port’, ‘9001’, ‘-env’, ‘-runDir’, ‘C:\Users\ADMINI~1\AppData\Local\Temp\tmpoch275nx\Minecraft\run’]
INFO:minerl.env.malmo.instance.2bc84f:Starting process watcher for process 9160 @ localhost:9001
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 106, in spawn_main
exitcode = _main(fd)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 115, in _main
prepare(preparation_data)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 226, in prepare
_fixup_main_from_path(data[‘init_main_from_path’])
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 278, in _fixup_main_from_path
run_name=“mp_main”)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\runpy.py”, line 240, in run_path
pkg_name=pkg_name, script_name=fname)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\runpy.py”, line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “E:\Output\Python_output\MineRL\baselines\test.py”, line 8, in
env = gym.make(‘MineRLNavigateDense-v0’)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 156, in make
return registry.make(id, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 101, in make
env = spec.make(kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 73, in make
env = cls(
_kwargs)
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\core.py”, line 132, in init
self.instance = self._get_new_instance(port)
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\core.py”, line 154, in _get_new_instance
instance.launch()
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\malmo.py”, line 373, in launch
parent_pid, self.minecraft_process.pid, self.host, port, self.instance_dir)
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\malmo.py”, line 584, in _launch_process_watcher
p.start()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\process.py”, line 105, in start
self._popen = self._Popen(self)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py”, line 212, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\context.py”, line 313, in _Popen
return Popen(process_obj)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\popen_spawn_win32.py”, line 34, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 144, in get_preparation_data
_check_not_importing_main()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py”, line 137, in _check_not_importing_main
is not going to be frozen to produce an executable.’’’)
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.

DEBUG:minerl.env.malmo.instance.11d85b::splitServerJar SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::mergeJars SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::applyBinaryPatches SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::extractDependencyATs SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::extractMcpData SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::extractMcpMappings SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::genSrgs SKIPPED
DEBUG:minerl.env.malmo.instance.11d85b::deobfMcMCP
DEBUG:minerl.env.malmo.instance.11d85b:Applying SpecialSource…
DEBUG:minerl.env.malmo.instance.11d85b:Applying Exceptor…
DEBUG:minerl.env.malmo.instance.11d85b::deobfMcMCP FAILED
DEBUG:minerl.env.malmo.instance.11d85b:
DEBUG:minerl.env.malmo.instance.11d85b:FAILURE: Build failed with an exception.
DEBUG:minerl.env.malmo.instance.11d85b:
DEBUG:minerl.env.malmo.instance.11d85b:* What went wrong:
DEBUG:minerl.env.malmo.instance.11d85b:Execution failed for task ‘:deobfMcMCP’.
DEBUG:minerl.env.malmo.instance.11d85b:> java.util.zip.ZipException: error in opening zip file
DEBUG:minerl.env.malmo.instance.11d85b:
DEBUG:minerl.env.malmo.instance.11d85b:* Try:
DEBUG:minerl.env.malmo.instance.11d85b:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
DEBUG:minerl.env.malmo.instance.11d85b:
DEBUG:minerl.env.malmo.instance.11d85b:BUILD FAILED
DEBUG:minerl.env.malmo.instance.11d85b:
DEBUG:minerl.env.malmo.instance.11d85b:Total time: 16.577 secs
ERROR:minerl.env.malmo.instance.11d85b:This mapping ‘snapshot_20161220’ was designed for MC 1.11! Use at your own peril.
ERROR:minerl.env.malmo.instance.11d85b:#################################################
ERROR:minerl.env.malmo.instance.11d85b: ForgeGradle 2.2-SNAPSHOT-3966cea
ERROR:minerl.env.malmo.instance.11d85b: https://github.com/MinecraftForge/ForgeGradle
ERROR:minerl.env.malmo.instance.11d85b:#################################################
ERROR:minerl.env.malmo.instance.11d85b: Powered by MCP unknown
ERROR:minerl.env.malmo.instance.11d85b: http://modcoderpack.com
ERROR:minerl.env.malmo.instance.11d85b: by: Searge, ProfMobius, Fesh0r,
ERROR:minerl.env.malmo.instance.11d85b: R4wk, ZeuX, IngisKahn, bspkrs
ERROR:minerl.env.malmo.instance.11d85b:#################################################
ERROR:minerl.env.malmo.instance.11d85b:Found AccessTransformer: malmomod_at.cfg
ERROR:minerl.env.malmo.instance.11d85b::deobfCompileDummyTask
ERROR:minerl.env.malmo.instance.11d85b::deobfProvidedDummyTask
ERROR:minerl.env.malmo.instance.11d85b::getVersionJson
ERROR:minerl.env.malmo.instance.11d85b::extractUserdev UP-TO-DATE
ERROR:minerl.env.malmo.instance.11d85b::downloadClient SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::downloadServer SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::splitServerJar SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::mergeJars SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::applyBinaryPatches SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::extractDependencyATs SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::extractMcpData SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::extractMcpMappings SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::genSrgs SKIPPED
ERROR:minerl.env.malmo.instance.11d85b::deobfMcMCP
ERROR:minerl.env.malmo.instance.11d85b:Applying SpecialSource…
ERROR:minerl.env.malmo.instance.11d85b:Applying Exceptor…
ERROR:minerl.env.malmo.instance.11d85b::deobfMcMCP FAILED
ERROR:minerl.env.malmo.instance.11d85b:
ERROR:minerl.env.malmo.instance.11d85b:FAILURE: Build failed with an exception.
ERROR:minerl.env.malmo.instance.11d85b:
ERROR:minerl.env.malmo.instance.11d85b:* What went wrong:
ERROR:minerl.env.malmo.instance.11d85b:Execution failed for task ‘:deobfMcMCP’.
ERROR:minerl.env.malmo.instance.11d85b:> java.util.zip.ZipException: error in opening zip file
ERROR:minerl.env.malmo.instance.11d85b:
ERROR:minerl.env.malmo.instance.11d85b:* Try:
ERROR:minerl.env.malmo.instance.11d85b:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
ERROR:minerl.env.malmo.instance.11d85b:
ERROR:minerl.env.malmo.instance.11d85b:BUILD FAILED
ERROR:minerl.env.malmo.instance.11d85b:
ERROR:minerl.env.malmo.instance.11d85b:Total time: 16.577 secs
Traceback (most recent call last):
File “E:/Output/Python_output/MineRL/baselines/test.py”, line 8, in
env = gym.make(‘MineRLNavigateDense-v0’)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 156, in make
return registry.make(id, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 101, in make
env = spec.make(kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\site-packages\gym\envs\registration.py”, line 73, in make
env = cls(
_kwargs)
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\core.py”, line 132, in init
self.instance = self._get_new_instance(port)
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\core.py”, line 154, in _get_new_instance
instance.launch()
File “C:\Users\Administrator\AppData\Roaming\Python\Python35\site-packages\minerl\env\malmo.py”, line 397, 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-3966cea
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
Applying SpecialSource…
Applying Exceptor…
:deobfMcMCP FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:deobfMcMCP’.

java.util.zip.ZipException: error in opening zip file

  • 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: 16.577 secs

Minecraft process finished unexpectedly. There was an error with Malmo.

Process finished with exit code 1

When it success, the logs are:

INFO:minerl.env.malmo.instance.1b427b:Starting Minecraft process: [‘C:\Users\ADMINI~1\AppData\Local\Temp\tmpa2gfnnwv\Minecraft\launchClient.bat’, ‘-port’, ‘9001’, ‘-env’, ‘-runDir’, ‘C:\Users\ADMINI~1\AppData\Local\Temp\
tmpa2gfnnwv\Minecraft\run’]
INFO:minerl.env.malmo.instance.1b427b:Starting process watcher for process 1300 @ localhost:9001
INFO:minerl.env.malmo.instance.063c06:Starting Minecraft process: [‘C:\Users\ADMINI~1\AppData\Local\Temp\tmp5q0qid1a\Minecraft\launchClient.bat’, ‘-port’, ‘9001’, ‘-env’, ‘-runDir’, ‘C:\Users\ADMINI~1\AppData\Local\Temp\
tmp5q0qid1a\Minecraft\run’]
INFO:minerl.env.malmo.instance.063c06:Starting process watcher for process 3572 @ localhost:9001
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 105, in spawn_main
exitcode = _main(fd)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 114, in _main
prepare(preparation_data)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 225, in prepare
_fixup_main_from_path(data[‘init_main_from_path’])
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 277, in _fixup_main_from_path
run_name=“mp_main”)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “E:\Output\Python_output\MineRL\baselines\test.py”, line 8, in
env = gym.make(‘MineRLNavigateDense-v0’)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py”, line 156, in make
return registry.make(id, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py”, line 101, in make
env = spec.make(kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\gym\envs\registration.py”, line 73, in make
env = cls(
_kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\minerl\env\core.py”, line 132, in init
self.instance = self._get_new_instance(port)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\minerl\env\core.py”, line 154, in _get_new_instance
instance.launch()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\minerl\env\malmo.py”, line 373, in launch
parent_pid, self.minecraft_process.pid, self.host, port, self.instance_dir)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\minerl\env\malmo.py”, line 584, in _launch_process_watcher
p.start()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py”, line 105, in start
self._popen = self._Popen(self)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py”, line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py”, line 322, in _Popen
return Popen(process_obj)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\popen_spawn_win32.py”, line 33, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 143, in get_preparation_data
_check_not_importing_main()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py”, line 136, in _check_not_importing_main
is not going to be frozen to produce an executable.’’’)
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.

DEBUG:minerl.env.malmo.instance.1b427b:This mapping ‘snapshot_20161220’ was designed for MC 1.11! Use at your own peril
(other logs, but it success any way…)

Any help would be great, thank you very much !!

#2

Just to confirm you are running minerl >=0.2.0 correct?

#3

Hi there, I beleive we have fixed this! This is an issue on windows where sometimes if you are running multiprocess it wont fork.

If you experience this bug again, you can read more here on how to fix it:

http://www.minerl.io/docs/notes/windows.html

1 Like
#4

It works! You are right! This is a problem about running multiprocess on windows.

Thank you for your great help! :slight_smile:

1 Like