Error: Answer from Java side is empty
Opened this issue · 1 comments
Hello, I am running into a issue when trying to use the python openAI gym interface. Sorry I am posting this on the wrong repository, but there is no place to open an issue on the 4.5 version.
I am running on Gym-FightingICE 4.5. The issue happens when trying to initialize a game, before I can even take a single step in the environment
Traceback (most recent call last):
File "/home/wlans4/anaconda3/envs/fighting_env/lib/python3.8/site-packages/py4j/java_gateway.py", line 1188, in send_command
raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/wlans4/anaconda3/envs/fighting_env/lib/python3.8/site-packages/py4j/java_gateway.py", line 1014, in send_command
response = connection.send_command(command)
File "/home/wlans4/anaconda3/envs/fighting_env/lib/python3.8/site-packages/py4j/java_gateway.py", line 1192, in send_command
raise Py4JNetworkError(
py4j.protocol.Py4JNetworkError: Error while receiving
The python code that I am running is here:
env_id = 1
envs = ['FightingiceDisplayNoFrameskip-v0',
'FightingiceDisplayFrameskip-v0']
self.env = gym.make(envs[env_id], java_env_path="/home/wlans4/Documents/FightingAI/Gym-FightingICE/FTG4.50", port=4564, auto_start_up=True)
self.env.reset(p2="machete")
Here is my Java version:
java -version
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Here is my Python version:
python --version
Python 3.7.4
My linux distro:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
The game also opens in a window, but it is gets stuck forever while waiting for a response from the Java
If left running long enough (a few minutes), it also eventually says this:
raise Py4JNetworkError(msg, e)
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:4564)
I have tried running
java -cp FightingICE.jar:./lib/lwjgl/:./lib/natives/linux/:./lib/* Main --py4j
as mentioned in another post, but it throws this error
java -cp FightingICE.jar:./lib/lwjgl/:./lib/natives/linux/:./lib/* Main --py4j
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/glfw/GLFWKeyCallbackI
at Main.main(Main.java:19)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.glfw.GLFWKeyCallbackI
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
Seems that you are using the Oracle version of Java. On the fighingice competition website the following is stated:
please install OpenJDK (8 or later; Oracle JDK 11 is not supported) from (updated on June 13, 2019)
I would try to use OpenJDK.