Skip to content

Failed to start an environment with obs = env.reset() on macos #659

Open
@1931540

Description

import gym
import minerl
env = gym.make('MineRLBasaltFindCave-v0')

above code has no error

but got error with env.reset()

obs = env.reset()

I got the following error, and I cannot get minerl to work.

/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/runpy.py:127: RuntimeWarning: 'minerl.utils.process_watcher' found in sys.modules after import of package 'minerl.utils', but prior to execution of 'minerl.utils.process_watcher'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/gym/wrappers/time_limit.py", line 27, in reset
    return self.env.reset(**kwargs)
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/herobraine/env_specs/basalt_specs.py", line 78, in reset
    return self.env.reset()
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/herobraine/env_specs/basalt_specs.py", line 57, in reset
    return super().reset()
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/gym/core.py", line 251, in reset
    return self.env.reset(**kwargs)
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/_singleagent.py", line 22, in reset
    multi_obs = super().reset()
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/_multiagent.py", line 436, in reset
    self._setup_instances()
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/_multiagent.py", line 539, in _setup_instances
    self.instances.extend([f.result() for f in instance_futures])
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/_multiagent.py", line 539, in <listcomp>
    self.instances.extend([f.result() for f in instance_futures])
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/_multiagent.py", line 805, in _get_new_instance
    instance.launch(replaceable=self._is_fault_tolerant)
  File "/Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/malmo.py", line 427, in launch
    raise EOFError(
EOFError: /Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/env/../MCP-Reborn
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[15:58:21] [Render thread/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[15:58:22] [Render thread/ERROR]: Failed to verify authentication!
[15:58:22] [Render thread/INFO]: Setting user: Player657
[15:58:22] [Render thread/INFO]: Backend library: LWJGL version 3.2.1 SNAPSHOT
---- Minecraft Crash Report ----
// Why did you do that?

Time: 22-8-9 下午3:58
Description: Initializing game

java.lang.ExceptionInInitializerError
	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)
	at net.minecraft.client.main.Main.main(Main.java:154)
Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is initialized before GLFW.
	at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39)
	... 5 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)

-- Initialization --
Details:
Stacktrace:
	at net.minecraft.client.main.Main.main(Main.java:154)

-- System Details --
Details:
	Minecraft Version: 1.16.5
	Minecraft Version ID: 1.16.5
	Operating System: Mac OS X (x86_64) version 10.16
	Java Version: 1.8.0_312, Azul Systems, Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Azul Systems, Inc.
	Memory: 534386904 bytes (509 MB) / 1507852288 bytes (1438 MB) up to 3817865216 bytes (3641 MB)
	CPUs: 8
	JVM Flags: 1 total; -Xmx4G
	Launched Version: ~~NULL~~
	Backend library: LWJGL version 3.2.1 SNAPSHOT
	Backend API: NO CONTEXT
	GL Caps:
	Using VBOs: Yes
	Is Modded: Very likely; Jar signature invalidated
	Type: Client (map_client.txt)
	CPU: <unknown>
#@!@# Game crashed! Crash report saved to: #@!@# /Users/yubingquan/opt/anaconda3/envs/minerl2/lib/python3.8/site-packages/minerl/MCP-Reborn/./crash-reports/crash-2022-08-09_15.58.23-client.txt


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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions