Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLFW Issue #41

Closed
ManuelCortes23 opened this issue Apr 18, 2024 · 2 comments
Closed

GLFW Issue #41

ManuelCortes23 opened this issue Apr 18, 2024 · 2 comments

Comments

@ManuelCortes23
Copy link

ManuelCortes23 commented Apr 18, 2024

Getting the issue below when I try to load in any agent from any model version.. Seems to be threading issue with JVM but I am unable to fully debug it. Would be great to get some insight. Here is the full trace:

(vpt) manuelcortes@MBP-de-Manuel Video-Pre-Training % python run_agent.py --model models/2x.model --weights models/foundation-model-2x.weights 
---Loading model---
---Launching MineRL enviroment (be patient)---
INFO:minerl.env.malmo.instance.75a37c:Starting Minecraft process: ['/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/../MCP-Reborn/launchClient.sh', '-port', '9466', '-env', '-runDir', '/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/../MCP-Reborn/run']
INFO:process_watcher:Launching process watcher daemonizer.
/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/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))
INFO:process_watcher:Process watcher daemonizer launched successfully.
DEBUG:minerl.env.malmo.instance.75a37c:/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/../MCP-Reborn
DEBUG:minerl.env.malmo.instance.75a37c:SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
DEBUG:minerl.env.malmo.instance.75a37c:SLF4J: Defaulting to no-operation (NOP) logger implementation
DEBUG:minerl.env.malmo.instance.75a37c:SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
DEBUG:minerl.env.malmo.instance.75a37c:[17:44:06] [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'
DEBUG:minerl.env.malmo.instance.75a37c:[17:44:07] [Render thread/INFO]: Setting user: Player608
DEBUG:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/INFO]: Backend library: LWJGL version 3.2.1 SNAPSHOT
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
DEBUG:minerl.env.malmo.instance.75a37c:---- Minecraft Crash Report ----
DEBUG:minerl.env.malmo.instance.75a37c:// Sorry :(
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:Time: 17/04/24 17:44
DEBUG:minerl.env.malmo.instance.75a37c:Description: Initializing game
DEBUG:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:java.lang.ExceptionInInitializerError
DEBUG:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.main.Main.main(Main.java:154)
ERROR:minerl.env.malmo.instance.75a37c: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.
DEBUG:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39)
DEBUG:minerl.env.malmo.instance.75a37c:	... 5 more
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:A detailed walkthrough of the error, its code path and all known details is as follows:
DEBUG:minerl.env.malmo.instance.75a37c:---------------------------------------------------------------------------------------
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:-- Head --
DEBUG:minerl.env.malmo.instance.75a37c:Thread: Render thread
DEBUG:minerl.env.malmo.instance.75a37c:Stacktrace:
DEBUG:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:-- Initialization --
DEBUG:minerl.env.malmo.instance.75a37c:Details:
DEBUG:minerl.env.malmo.instance.75a37c:Stacktrace:
DEBUG:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.main.Main.main(Main.java:154)
DEBUG:minerl.env.malmo.instance.75a37c:
DEBUG:minerl.env.malmo.instance.75a37c:-- System Details --
DEBUG:minerl.env.malmo.instance.75a37c:Details:
DEBUG:minerl.env.malmo.instance.75a37c:	Minecraft Version: 1.16.5
DEBUG:minerl.env.malmo.instance.75a37c:	Minecraft Version ID: 1.16.5
DEBUG:minerl.env.malmo.instance.75a37c:	Operating System: Mac OS X (x86_64) version 14.3
DEBUG:minerl.env.malmo.instance.75a37c:	Java Version: 1.8.0_402, Temurin
DEBUG:minerl.env.malmo.instance.75a37c:	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin
DEBUG:minerl.env.malmo.instance.75a37c:	Memory: 1449601536 bytes (1382 MB) / 1700265984 bytes (1621 MB) up to 3817865216 bytes (3641 MB)
DEBUG:minerl.env.malmo.instance.75a37c:	CPUs: 11
DEBUG:minerl.env.malmo.instance.75a37c:	JVM Flags: 1 total; -Xmx4G
DEBUG:minerl.env.malmo.instance.75a37c:	Launched Version: ~~NULL~~
DEBUG:minerl.env.malmo.instance.75a37c:	Backend library: LWJGL version 3.2.1 SNAPSHOT
DEBUG:minerl.env.malmo.instance.75a37c:	Backend API: NO CONTEXT
DEBUG:minerl.env.malmo.instance.75a37c:	GL Caps: 
DEBUG:minerl.env.malmo.instance.75a37c:	Using VBOs: Yes
DEBUG:minerl.env.malmo.instance.75a37c:	Is Modded: Very likely; Jar signature invalidated
DEBUG:minerl.env.malmo.instance.75a37c:	Type: Client (map_client.txt)
DEBUG:minerl.env.malmo.instance.75a37c:	CPU: <unknown>
DEBUG:minerl.env.malmo.instance.75a37c:#@!@# Game crashed! Crash report saved to: #@!@# /Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/MCP-Reborn/./crash-reports/crash-2024-04-17_17.44.08-client.txt
ERROR:minerl.env.malmo.instance.75a37c:/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/../MCP-Reborn
ERROR:minerl.env.malmo.instance.75a37c:SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
ERROR:minerl.env.malmo.instance.75a37c:SLF4J: Defaulting to no-operation (NOP) logger implementation
ERROR:minerl.env.malmo.instance.75a37c:SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR:minerl.env.malmo.instance.75a37c:[17:44:06] [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'
ERROR:minerl.env.malmo.instance.75a37c:[17:44:07] [Render thread/INFO]: Setting user: Player608
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/INFO]: Backend library: LWJGL version 3.2.1 SNAPSHOT
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
ERROR:minerl.env.malmo.instance.75a37c:[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
ERROR:minerl.env.malmo.instance.75a37c:---- Minecraft Crash Report ----
ERROR:minerl.env.malmo.instance.75a37c:// Sorry :(
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:Time: 17/04/24 17:44
ERROR:minerl.env.malmo.instance.75a37c:Description: Initializing game
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:java.lang.ExceptionInInitializerError
ERROR:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.main.Main.main(Main.java:154)
ERROR:minerl.env.malmo.instance.75a37c: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.
ERROR:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39)
ERROR:minerl.env.malmo.instance.75a37c:	... 5 more
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:A detailed walkthrough of the error, its code path and all known details is as follows:
ERROR:minerl.env.malmo.instance.75a37c:---------------------------------------------------------------------------------------
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:-- Head --
ERROR:minerl.env.malmo.instance.75a37c:Thread: Render thread
ERROR:minerl.env.malmo.instance.75a37c:Stacktrace:
ERROR:minerl.env.malmo.instance.75a37c:	at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.MainWindow.<init>(MainWindow.java:91)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.renderer.VirtualScreen.create(VirtualScreen.java:21)
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.Minecraft.<init>(Minecraft.java:408)
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:-- Initialization --
ERROR:minerl.env.malmo.instance.75a37c:Details:
ERROR:minerl.env.malmo.instance.75a37c:Stacktrace:
ERROR:minerl.env.malmo.instance.75a37c:	at net.minecraft.client.main.Main.main(Main.java:154)
ERROR:minerl.env.malmo.instance.75a37c:
ERROR:minerl.env.malmo.instance.75a37c:-- System Details --
ERROR:minerl.env.malmo.instance.75a37c:Details:
ERROR:minerl.env.malmo.instance.75a37c:	Minecraft Version: 1.16.5
ERROR:minerl.env.malmo.instance.75a37c:	Minecraft Version ID: 1.16.5
ERROR:minerl.env.malmo.instance.75a37c:	Operating System: Mac OS X (x86_64) version 14.3
ERROR:minerl.env.malmo.instance.75a37c:	Java Version: 1.8.0_402, Temurin
ERROR:minerl.env.malmo.instance.75a37c:	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin
ERROR:minerl.env.malmo.instance.75a37c:	Memory: 1449601536 bytes (1382 MB) / 1700265984 bytes (1621 MB) up to 3817865216 bytes (3641 MB)
ERROR:minerl.env.malmo.instance.75a37c:	CPUs: 11
ERROR:minerl.env.malmo.instance.75a37c:	JVM Flags: 1 total; -Xmx4G
ERROR:minerl.env.malmo.instance.75a37c:	Launched Version: ~~NULL~~
ERROR:minerl.env.malmo.instance.75a37c:	Backend library: LWJGL version 3.2.1 SNAPSHOT
ERROR:minerl.env.malmo.instance.75a37c:	Backend API: NO CONTEXT
ERROR:minerl.env.malmo.instance.75a37c:	GL Caps: 
ERROR:minerl.env.malmo.instance.75a37c:	Using VBOs: Yes
ERROR:minerl.env.malmo.instance.75a37c:	Is Modded: Very likely; Jar signature invalidated
ERROR:minerl.env.malmo.instance.75a37c:	Type: Client (map_client.txt)
ERROR:minerl.env.malmo.instance.75a37c:	CPU: <unknown>
ERROR:minerl.env.malmo.instance.75a37c:#@!@# Game crashed! Crash report saved to: #@!@# /Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/MCP-Reborn/./crash-reports/crash-2024-04-17_17.44.08-client.txt
Traceback (most recent call last):
  File "/Users/manuelcortes/Documents/GitHub/Video-Pre-Training/run_agent.py", line 36, in <module>
    main(args.model, args.weights)
  File "/Users/manuelcortes/Documents/GitHub/Video-Pre-Training/run_agent.py", line 20, in main
    obs = env.reset()
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/_singleagent.py", line 22, in reset
    multi_obs = super().reset()
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/_multiagent.py", line 436, in reset
    self._setup_instances()
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/_multiagent.py", line 539, in _setup_instances
    self.instances.extend([f.result() for f in instance_futures])
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/_multiagent.py", line 539, in <listcomp>
    self.instances.extend([f.result() for f in instance_futures])
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/_multiagent.py", line 805, in _get_new_instance
    instance.launch(replaceable=self._is_fault_tolerant)
  File "/Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/env/malmo.py", line 427, in launch
    raise EOFError(
EOFError: /Users/manuelcortes/miniconda3/envs/vpt/lib/python3.9/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.
[17:44:06] [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'
[17:44:07] [Render thread/INFO]: Setting user: Player608
[17:44:08] [Render thread/INFO]: Backend library: LWJGL version 3.2.1 SNAPSHOT
[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
[17:44:08] [Render thread/ERROR]: GLFW error collected during initialization: GLFW error during init: [0x10008]12967701680
---- Minecraft Crash Report ----
// Sorry :(

Time: 17/04/24 17:44
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 14.3
	Java Version: 1.8.0_402, Temurin
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin
	Memory: 1449601536 bytes (1382 MB) / 1700265984 bytes (1621 MB) up to 3817865216 bytes (3641 MB)
	CPUs: 11
	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/manuelcortes/miniconda3/envs/vpt/lib/python3.9/site-packages/minerl/MCP-Reborn/./crash-reports/crash-2024-04-17_17.44.08-client.txt


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



@Miffyli
Copy link
Collaborator

Miffyli commented Apr 18, 2024

Hey. opengl ("gl"-something) errors usually happen when there is no proper rendering pipeline setup, usually result of not having a display attached to the machine. Try using xvfb-run -a python your_script.py to run the script. If that does not work, you might have to look at alternative ways of having valid display buffer on your machine for Minecraft to render to. MineDojo had some tricks as well to potentially avoid this, so it can give pointers if this suggestion fails.

Edit: Ah, I just noticed you are running on Mac. Mac by default is not supported, but you can try following these tips to make it work: minerllabs/minerl#659 (comment) . You should also install newest MineRL version with pip install git+https://github.com/minerllabs/minerl

@ManuelCortes23
Copy link
Author

Wow, whoever figured this out did a great job. Very easy to follow and now it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants