minerllabs / minerl

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

Build failed with an exception #559

Closed RainCatalyst closed 3 years ago

RainCatalyst commented 3 years ago

I was trying to run this example script, but it returns an error.

import minerl
import gym
import logging

logging.basicConfig(level=logging.DEBUG)

env = gym.make('MineRLTreechop-v0')
obs  = env.reset()

Here are the error messages (from the logger):

ERROR:minerl.env.malmo.instance.e929e1:FAILURE: Build failed with an exception. ERROR:minerl.env.malmo.instance.e929e1: ERROR:minerl.env.malmo.instance.e929e1: What went wrong: ERROR:minerl.env.malmo.instance.e929e1:Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
ERROR:minerl.env.malmo.instance.e929e1:> Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache(). ERROR:minerl.env.malmo.instance.e929e1: ERROR:minerl.env.malmo.instance.e929e1:
Try: ERROR:minerl.env.malmo.instance.e929e1:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ERROR:minerl.env.malmo.instance.e929e1: ERROR:minerl.env.malmo.instance.e929e1:* Get more help at https://help.gradle.org ERROR:minerl.env.malmo.instance.e929e1: ERROR:minerl.env.malmo.instance.e929e1:BUILD FAILED in 0s

The errors say that I should run the build with --stacktrace option to get more information, but I'm not sure how to do it...

I have both JDK and JRE installed, both are version 8. Python 3.9.6

Miffyli commented 3 years ago

The information should be visible in the logs as. Can you paste/share the complete log that is printed once you run the code?

Also check the jdk/jre versions you are running with java -version. Only newer version of JDK 8 work, like jdk-8u291 or 153.

RainCatalyst commented 3 years ago

Full log looks like this

C:\Program Files\Python39\lib\site-packages\gym\logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32 warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow')) INFO:minerl.env.malmo.instance.c63792:Starting Minecraft process: ['C:\Users\freee\AppData\Local\Temp\tmprmfhjytf\Minecraft\launchClient.bat', '-port', '9396', '-env', '-runDir', 'C:\Users\freee\AppData\Local\Temp\tmprmfhjytf\Minecraft\run'] INFO:process_watcher:Launhing process watcher daemonizer. C:\Program Files\Python39\lib\site-packages\gym\logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32 warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow')) C:\Program Files\Python39\lib\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)) C:\Program Files\Python39\lib\runpy.py:127: RuntimeWarning: 'daemoniker._daemonize_windows' found in sys.modules after import of package 'daemoniker', but prior to execution of 'daemoniker._daemonize_windows'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) INFO:process_watcher:Process watcher daemonizer launched successfully. DEBUG:minerl.env.malmo.instance.c63792:Access is denied. DEBUG:minerl.env.malmo.instance.c63792: DEBUG:minerl.env.malmo.instance.c63792:FAILURE: Build failed with an exception. DEBUG:minerl.env.malmo.instance.c63792: DEBUG:minerl.env.malmo.instance.c63792: What went wrong: DEBUG:minerl.env.malmo.instance.c63792:Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
DEBUG:minerl.env.malmo.instance.c63792:> Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache(). DEBUG:minerl.env.malmo.instance.c63792: DEBUG:minerl.env.malmo.instance.c63792:
Try: DEBUG:minerl.env.malmo.instance.c63792:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. DEBUG:minerl.env.malmo.instance.c63792: DEBUG:minerl.env.malmo.instance.c63792:* Get more help at https://help.gradle.org DEBUG:minerl.env.malmo.instance.c63792: DEBUG:minerl.env.malmo.instance.c63792:BUILD FAILED in 1s The last few lines (starting from build failed) repeat as it tries to run the build again.

java -version returns

java version "1.8.0_291" Java(TM) SE Runtime Environment (build 1.8.0_291-b10) Java HotSpot(TM) Client VM (build 25.291-b10, mixed mode, sharing)

Miffyli commented 3 years ago

Quick googling suggests that it might be using newer Java version by accident: https://stackoverflow.com/questions/53272230/could-not-create-service-of-type-scriptpluginfactory-using-buildscopeservices-cr

Can you check javac -version?

If those fail, here are the java versions I use successfully: Windows 10: 1.8.0_121 Ubuntu 20.04: openjdk version "1.8.0_292"

RainCatalyst commented 3 years ago

I'm not sure what I did, but now it actually seems to start minecraft. It goes through the whole process of setting up the client (which takes around 2-3 minutes) each time I run it though and the minecraft window appears frozen (the agent seems to be running).

Miffyli commented 3 years ago

Yup that is correct! The window appears frozen, but as long things look good on Python side it is all good :).

(and yeah, "have you tried restarting it?" works many times with MineRL ^^).

Closing as solved.