minerllabs / minerl

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

MacOS Installation #406

Open will-maclean opened 4 years ago

will-maclean commented 4 years ago

Hi, I'm currently having some issues running minerl for the first time. I'm on macOS 10.15.6, working in a python 3.7 venv. I'm getting the following issue:

Traceback (most recent call last):
  File "/Users/will/OneDrive/DeepNeuron/minerl/ddqn/find_diamonds.py", line 31, in <module>
    main()
  File "/Users/will/OneDrive/DeepNeuron/minerl/ddqn/find_diamonds.py", line 7, in main
    env = gym.make("MineRLObtainDiamond-v0")  # A MineRLObtainDiamond-v0 env
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/gym/envs/registration.py", line 145, in make
    return registry.make(id, **kwargs)
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/gym/envs/registration.py", line 90, in make
    env = spec.make(**kwargs)
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/gym/envs/registration.py", line 60, in make
    env = cls(**_kwargs)
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/minerl/env/core.py", line 137, in __init__
    self.instance = self._get_new_instance(port)
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/minerl/env/core.py", line 159, in _get_new_instance
    instance.launch()
  File "/Users/will/PycharmProjects/venvs/minerl_venv/lib/python3.7/site-packages/minerl/env/malmo.py", line 512, in launch
    raise EOFError(error_str + "\n\nMinecraft process finished unexpectedly. There was an error with Malmo.")
EOFError: 
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '11.0.3'.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.IllegalArgumentException: Could not determine java version from '11.0.3'.
    at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:68)
    at org.gradle.api.JavaVersion.current(JavaVersion.java:78)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

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

Does anyone know what the fix is?

will-maclean commented 4 years ago

I've tried the fix outlined in this issue, but that hasn't worked, even with a new venv.

brandonhoughton commented 4 years ago

This seems like an openjdk issue? What version of Java are you running? Additionally Mac has issues with Java after Catalina, I know JDK 152 is safe, and we install Java through conda with

conda install -c anaconda openjdk

will-maclean commented 4 years ago

Should I still be using that conda command if I'm not using a conda environment? Or should I be using a conda environment?

--Update-- Made a conda environment and tried it all in there, including conda install anaconda openjdk, but still getting the same error

brandonhoughton commented 4 years ago

What does $JAVA_HOME resolve to?

will-maclean commented 4 years ago

$JAVA_HOME wasn't set, so I set it to /usr/local/opt/openjdk. Now when I try to run my script, I get:

Traceback (most recent call last):
  File "/Users/willmaclean/OneDrive/DeepNeuron/minerl/ddqn/find_diamonds.py", line 31, in <module>
    main()
  File "/Users/willmaclean/OneDrive/DeepNeuron/minerl/ddqn/find_diamonds.py", line 7, in main
    env = gym.make("MineRLObtainDiamond-v0")  # A MineRLObtainDiamond-v0 env
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/gym/envs/registration.py", line 145, in make
    return registry.make(id, **kwargs)
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/gym/envs/registration.py", line 90, in make
    env = spec.make(**kwargs)
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/gym/envs/registration.py", line 60, in make
    env = cls(**_kwargs)
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/minerl/env/core.py", line 137, in __init__
    self.instance = self._get_new_instance(port)
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/minerl/env/core.py", line 159, in _get_new_instance
    instance.launch()
  File "/Users/willmaclean/miniconda3/envs/minerl/lib/python3.7/site-packages/minerl/env/malmo.py", line 512, in launch
    raise EOFError(error_str + "\n\nMinecraft process finished unexpectedly. There was an error with Malmo.")
EOFError: 
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '14.0.1'.

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.IllegalArgumentException: Could not determine java version from '14.0.1'.
    at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:68)
    at org.gradle.api.JavaVersion.current(JavaVersion.java:78)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:32)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

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

The java seems to have changed to 14.0.1. What should JAVA_HOME be?

chaseabrown commented 3 years ago

I just solved this issue on my machine (Big Sur 11.1)

You have to change the Java_home -v to 1.8.0.

  1. Install 1.8.0 jdk here
  2. Type this into terminal and check to make sure it is in this list /usr/libexec/java_home -V
  3. Again in terminal unset JAVA_HOME;export JAVA_HOME='/usr/libexec/java_home -v 1.8.0'
  4. java -version should show that you are using 1.8.0 and it should work after that. It did for me at least.