minerllabs / minerl

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

How can I run it remotely via SSH #68

Open chenjunjie1994 opened 5 years ago

chenjunjie1994 commented 5 years ago

@MadcowD

How can I run the environment remotely via SSH ? Even with xvfb-run, it reports error as shown below. I installed vncserver, then start it and get

New 'c8c13cac-4e57-458c-abb6-85dfaf5ac9:1 (root)' desktop is c8c13cac-4e57-458c-abb6-85dfaf5ac9:1

Then I ` export DISPLAY=c8c13cac-4e57-458c-abb6-85dfaf5ac9:1

But it does not work. BTW, I have a GPU on the machine.

Can somebody help with it ? Do I have to install Desktop like GNOME ? What actually should I do to make it work?

Thanks.

My Code:

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

obs, _ = env.reset() done = False net_reward = 0

while not done: action = env.action_space.noop()

action['camera'] = [0, 0.03*obs["compassAngle"]]
action['back'] = 0
action['forward'] = 1
action['jump'] = 1
action['attack'] = 1

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

net_reward += reward
print("Total reward: ", net_reward)

============================================= INFO:minerl.env.malmo:Starting Minecraft process: ['/root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/launchClient.sh', '-port', '9000', '-env'] DEBUG:minerl.env.malmo:This mapping 'snapshot_20161220' was designed for MC 1.11! Use at your own peril. DEBUG:minerl.env.malmo:################################################# DEBUG:minerl.env.malmo: ForgeGradle 2.2-SNAPSHOT-3966cea
DEBUG:minerl.env.malmo: https://github.com/MinecraftForge/ForgeGradle
DEBUG:minerl.env.malmo:################################################# DEBUG:minerl.env.malmo: Powered by MCP unknown
DEBUG:minerl.env.malmo: http://modcoderpack.com
DEBUG:minerl.env.malmo: by: Searge, ProfMobius, Fesh0r,
DEBUG:minerl.env.malmo: R4wk, ZeuX, IngisKahn, bspkrs
DEBUG:minerl.env.malmo:################################################# DEBUG:minerl.env.malmo:Found AccessTransformer: malmomod_at.cfg DEBUG:minerl.env.malmo::deobfCompileDummyTask DEBUG:minerl.env.malmo::deobfProvidedDummyTask DEBUG:minerl.env.malmo::getVersionJson DEBUG:minerl.env.malmo::extractUserdev DEBUG:minerl.env.malmo::downloadClient SKIPPED DEBUG:minerl.env.malmo::downloadServer SKIPPED DEBUG:minerl.env.malmo::splitServerJar SKIPPED DEBUG:minerl.env.malmo::mergeJars SKIPPED DEBUG:minerl.env.malmo::applyBinaryPatches SKIPPED DEBUG:minerl.env.malmo::extractDependencyATs SKIPPED DEBUG:minerl.env.malmo::extractMcpData SKIPPED DEBUG:minerl.env.malmo::extractMcpMappings SKIPPED DEBUG:minerl.env.malmo::genSrgs SKIPPED DEBUG:minerl.env.malmo::deobfMcMCP DEBUG:minerl.env.malmo:Applying SpecialSource... DEBUG:minerl.env.malmo:Applying Exceptor... DEBUG:minerl.env.malmo:Applying RuntimeInvisibleParameterAnnotations workaround... DEBUG:minerl.env.malmo::sourceApiJava DEBUG:minerl.env.malmo::compileApiJava UP-TO-DATE DEBUG:minerl.env.malmo::processApiResources UP-TO-DATE DEBUG:minerl.env.malmo::apiClasses UP-TO-DATE DEBUG:minerl.env.malmo::copyModToClient DEBUG:minerl.env.malmo::copyModToServer DEBUG:minerl.env.malmo::copySrg DEBUG:minerl.env.malmo::deleteSchemas DEBUG:minerl.env.malmo::copySchemas DEBUG:minerl.env.malmo::jaxb DEBUG:minerl.env.malmo::sourceMainJava DEBUG:minerl.env.malmo::compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.6 DEBUG:minerl.env.malmo:Note: SpongePowered MIXIN Annotation Processor Version=0.7.5 DEBUG:minerl.env.malmo:Note: ObfuscationServiceMCP supports type: "searge" DEBUG:minerl.env.malmo:Note: ObfuscationServiceMCP supports type: "notch" DEBUG:minerl.env.malmo:Note: Loading searge mappings from /root/.gradle/caches/minecraft/de/oceanlabs/mcp/mcp_snapshot/20161220/1.11.2/srgs/mcp-srg.srg DEBUG:minerl.env.malmo:Note: Loading notch mappings from /root/.gradle/caches/minecraft/de/oceanlabs/mcp/mcp_snapshot/20161220/1.11.2/srgs/mcp-notch.srg DEBUG:minerl.env.malmo:Note: Writing refmap to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/compileJava-refmap.json DEBUG:minerl.env.malmo:Note: Writing searge output SRGs to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/mcp-srg.srg DEBUG:minerl.env.malmo:Note: Writing notch output SRGs to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/mcp-notch.srg DEBUG:minerl.env.malmo:Note: Writing refmap to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/compileJava-refmap.json DEBUG:minerl.env.malmo:Note: Writing searge output SRGs to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/mcp-srg.srg DEBUG:minerl.env.malmo:Note: Writing notch output SRGs to /root/anaconda3/lib/python3.7/site-packages/minerl/env/Malmo/Minecraft/build/tmp/compileJava/mcp-notch.srg DEBUG:minerl.env.malmo:Note: Some input files use or override a deprecated API. DEBUG:minerl.env.malmo:Note: Recompile with -Xlint:deprecation for details. DEBUG:minerl.env.malmo:Note: Some input files use unchecked or unsafe operations. DEBUG:minerl.env.malmo:Note: Recompile with -Xlint:unchecked for details. DEBUG:minerl.env.malmo: DEBUG:minerl.env.malmo::processResources DEBUG:minerl.env.malmo::classes DEBUG:minerl.env.malmo::jar DEBUG:minerl.env.malmo::extractNatives SKIPPED DEBUG:minerl.env.malmo::getAssetIndex UP-TO-DATE DEBUG:minerl.env.malmo::getAssets DEBUG:minerl.env.malmo::makeStart SKIPPED DEBUG:minerl.env.malmo::runClient DEBUG:minerl.env.malmo:[17:07:43] [main/INFO]: Extra: [] DEBUG:minerl.env.malmo:[17:07:43] [main/INFO]: Found and added coremod: com.microsoft.Malmo.OverclockingPlugin DEBUG:minerl.env.malmo:[17:07:43] [main/INFO]: Running with arguments: [--userProperties, {}, --assetsDir, /root/.gradle/caches/minecraft/assets, --assetIndex, 1.11, --accessToken{REDACTED}, --version, 1.11.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Forge Mod Loader version 13.20.0.2228 for Minecraft 1.11.2 loading DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_211, running on Linux:amd64:3.10.107-1-tlinux2-0047, installed at /usr/java/jdk1.8.0_211-amd64/jre DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Found a command line coremod : com.microsoft.Malmo.OverclockingPlugin DEBUG:minerl.env.malmo:[17:07:44] [main/WARN]: The coremod com.microsoft.Malmo.OverclockingPlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.7.5 Source=file:/root/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.7.5-SNAPSHOT/c989878008c2c5ff1a7c6491c4103d8faa221d19/mixin-0.7.5-SNAPSHOT.jar Service=LaunchWrapper Env=CLIENT DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Compatibility level set to JAVA_8 DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Injecting location in coremod com.microsoft.Malmo.OverclockingPlugin DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper DEBUG:minerl.env.malmo:[17:07:44] [main/ERROR]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! DEBUG:minerl.env.malmo:[17:07:44] [main/ERROR]: FML appears to be missing any signature data. This is not a good thing DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Initialised Mixin FML Remapper Adapter with net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper@6ac4944a DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/INFO]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker DEBUG:minerl.env.malmo:[17:07:44] [main/WARN]: Reference map 'mixins.replaymod.refmap.json' for mixins.overclocking.malmomod.json could not be read. If this is a development environment you can ignore this message DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:58]: MALMO: Attempting to transform MinecraftServer DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:129]: MALMO: Found Minecraft, attempting to transform it DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:135]: MALMO: Found Minecraft.runGameLoop() method, attempting to transform it DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:150]: MALMO: Hooked into call to Minecraft.updateDisplay() DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: A re-entrant transformer '$wrapper.com.microsoft.Malmo.OverclockingClassTransformer' was detected and will no longer process meta class data DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: Launching wrapped minecraft {net.minecraft.client.main.Main} DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:58]: MALMO: Attempting to transform MinecraftServer DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:129]: MALMO: Found Minecraft, attempting to transform it DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:135]: MALMO: Found Minecraft.runGameLoop() method, attempting to transform it DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:overclockRenderer:150]: MALMO: Hooked into call to Minecraft.updateDisplay() DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:42]: Transformed Name: net.minecraft.client.entity.EntityPlayerSP DEBUG:minerl.env.malmo:[17:07:45] [main/INFO]: [com.microsoft.Malmo.OverclockingClassTransformer:transform:42]: Transformed Name: net.minecraft.client.entity.AbstractClientPlayer DEBUG:minerl.env.malmo:[17:07:45] [Client thread/INFO]: Setting user: Player727 DEBUG:minerl.env.malmo:[17:07:47] [Client thread/WARN]: Skipping bad option: lastServer: DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: LWJGL Version: 2.9.4 DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: [STDOUT]: MALMO: Attempting to transform MinecraftServer DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: [STDOUT]: MALMO: Found GlStateManager, attempting to transform it DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: [STDOUT]: MALMO: Found GlStateManager.bindTexture() method, attempting to transform it DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: [STDOUT]: MALMO: Hooked into call to GlStateManager.bindTexture() DEBUG:minerl.env.malmo:[17:07:47] [Client thread/INFO]: [net.minecraft.init.Bootstrap:printToSYSOUT:523]: ---- Minecraft Crash Report ---- DEBUG:minerl.env.malmo:// Surprise! Haha. Well, this is awkward. DEBUG:minerl.env.malmo: DEBUG:minerl.env.malmo:Time: 6/19/19 5:07 PM DEBUG:minerl.env.malmo:Description: Initializing game DEBUG:minerl.env.malmo: DEBUG:minerl.env.malmo:java.lang.ExceptionInInitializerError DEBUG:minerl.env.malmo: at net.minecraft.client.Minecraft.setWindowIcon(Minecraft.java:629) DEBUG:minerl.env.malmo: at net.minecraft.client.Minecraft.init(Minecraft.java:429) DEBUG:minerl.env.malmo: at net.minecraft.client.Minecraft.run(Minecraft.java:352) DEBUG:minerl.env.malmo: at net.minecraft.client.main.Main.main(SourceFile:124) DEBUG:minerl.env.malmo: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) DEBUG:minerl.env.malmo: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) DEBUG:minerl.env.malmo: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) DEBUG:minerl.env.malmo: at java.lang.reflect.Method.invoke(Method.java:498) DEBUG:minerl.env.malmo: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) DEBUG:minerl.env.malmo: at net.minecraft.launchwrapper.Launch.main(Launch.java:28) DEBUG:minerl.env.malmo: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) DEBUG:minerl.env.malmo: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) DEBUG:minerl.env.malmo: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) DEBUG:minerl.env.malmo: at java.lang.reflect.Method.invoke(Method.java:498) DEBUG:minerl.env.malmo: at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) DEBUG:minerl.env.malmo: at GradleStart.main(GradleStart.java:26) DEBUG:minerl.env.malmo:Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No display mode extension is available Traceback (most recent call last): File "testpy.py", line 11, in env = gym.make('MineRLNavigateDense-v0') File "/root/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 183, in make return registry.make(id, kwargs) File "/root/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 125, in make env = spec.make(kwargs) File "/root/anaconda3/lib/python3.7/site-packages/gym/envs/registration.py", line 89, in make env = cls(**_kwargs) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/core.py", line 131, in init self.init(observation_space, action_space, port=port) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/core.py", line 155, in init self.instance = InstanceManager.get_instance().enter() File "/root/anaconda3/lib/python3.7/contextlib.py", line 112, in enter return next(self.gen) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/malmo.py", line 89, in get_instance inst = cls._Instance(cls._get_valid_port()) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/malmo.py", line 259, in init self.launch(port, existing) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/malmo.py", line 290, in launch _check_for_launch_errors(line) File "/root/anaconda3/lib/python3.7/site-packages/minerl/env/malmo.py", line 509, in _check_for_launch_errors "ERROR! MineRL could not detect an X Server, Monitor, or Virtual Monitor! " RuntimeError: ERROR! MineRL could not detect an X Server, Monitor, or Virtual Monitor!

In order to run minerl environments WITHOUT A HEAD use a software renderer such as 'xvfb': xvfb-run python3 ! NOTE: xvfb conflicts with NVIDIA-drivers! ! To run headless MineRL on a system with NVIDIA-drivers, please start a ! vnc server of your choosing and then `export DISPLAY=:<insert ur vnc server #>

If you're receiving this error and there is a monitor attached, make sure your current displayvariable is set correctly: DISPLAY=:0 python3 ! NOTE: For this to work your account must be logged on the physical monitor.

If none of these steps work, please complain in the discord! If all else fails, JUST PUT THIS IN A DOCKER CONTAINER! :)

Originally posted by @chenjunjie1994 in https://github.com/minerllabs/minerl/issues/58#issuecomment-503482340

MadcowD commented 5 years ago

Can you try starting another GUI program in that VNC server to make sure its working.

For example, try running firefox or glxgears.

MadcowD commented 5 years ago

@chenjunjie1994 Just following up here.

chenjunjie1994 commented 5 years ago

@chenjunjie1994 Just following up here.

@MadcowD Ahh...i can not use vnc viewer to connect that vnc server because of some network management issues. But I instead install minerl in my PC without GPU, and it works.

Scitator commented 5 years ago

@MadcowD Due to large number of questions like that, is it possible to create an additional started guide with MineRL on headless machine?

MadcowD commented 5 years ago

@Scitator This sounds like a great idea! I've been meaning to do this for a while. As soon as we get the evaluator out I will make sure this happens :)

tmhm commented 5 years ago

@chenjunjie1994 I got the same crash with xvfb-run like yours, and i also found minerl can work well on my laptop without GPU. Do you have some solutions for this? Thank you!

tmhm commented 5 years ago

Hi, @MadcowD , I could running others GUI app with the remote desktop, likes firefox, But, i still got the same error with run the example code from @chenjunjie1994 above.

And, I try to run docker with this guy's dockerfile, I'm found that it's could not work with my headless-GPU server yet. Best wish to any more helps!Thanks :)

starimpact commented 5 years ago

i think it is hard to do this competition in headless gpu server. sadly....this problem is really bad.

tmhm commented 5 years ago

if use docker environment, @starimpact Your Docker should base from ubuntu 18.04, not ubuntu16

and then xvfb works.

likes xvfb-run --auto-servernum --server-args="-screen 0 1280x760x24" python3 YOUR-SCRIPTS.py

starimpact commented 5 years ago

anyway, thanks for your reply.

brandonhoughton commented 4 years ago

Duplicated by #63