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

TypeError: a bytes-like object is required, not 'NoneType' #750

Open
CooLeee opened this issue Feb 16, 2024 · 5 comments
Open

TypeError: a bytes-like object is required, not 'NoneType' #750

CooLeee opened this issue Feb 16, 2024 · 5 comments

Comments

@CooLeee
Copy link

CooLeee commented Feb 16, 2024

Hi , I have this issue when running on the docker image built for BASLAT2022. I also checked MineRL Java and JDK versions. running other MineRL environments on this iage like HumanSurvival or MineRLBasaltFindCave does't has this issue.

test.py :

import gym
import minerl

env = gym.make("MineRLNavigate-v0") # A MineRLNavigate-v0 env
obs = env.reset()
print('done reset'+'*'*100) # the reset was never finished

log output :

root@3b815afc0403:/home/project# pip show minerl
Name: minerl
Version: 1.0.0
Summary: MineRL environment and data loader for reinforcement learning from human demonstration in Minecraft
Home-page: http://github.com/minerllabs/minerl
Author: MineRL Labs
Author-email: minerl@andrew.cmu.edu
License: MIT
Location: /home/aicrowd/.conda/envs/minerl/lib/python3.7/site-packages
Requires: coloredlogs, daemoniker, dill, flaky, getch, gym, imagehash, inflection, ipython, jinja2, lxml, numpy, opencv-python, pillow, psutil, pyglet, Pyro4, requests, setuptools, tqdm, typing, xmltodict
Required-by:
root@3b815afc0403:/home/project# java -version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-8u372-ga~us1-0ubuntu1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
root@3b815afc0403:/home/project# javac -version
javac 1.8.0_362
root@3b815afc0403:/home/project# dpkg --list | grep -i java
ii ca-certificates-java 20180516ubuntu1~18.04.1 all Common CA certificates (JKS keystore)
ii java-common 0.68ubuntu1~18.04.1 all Base package for Java runtimes
ii libatk-wrapper-java 0.33.3-20ubuntu0.1 all ATK implementation for Java using JNI
ii libatk-wrapper-java-jni:amd64 0.33.3-20ubuntu0.1 amd64 ATK implementation for Java using JNI (JNI bindings)
ii openjdk-8-jre:amd64 8u372-ga~us1-0ubuntu1~18.04 amd64 OpenJDK Java runtime, using Hotspot JIT
ii openjdk-8-jre-headless:amd64 8u372-ga~us1-0ubuntu1~18.04 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
root@3b815afc0403:/home/project# xvfb-run python3 test.py
/home/aicrowd/.conda/envs/minerl/lib/python3.7/runpy.py:125: 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))
Traceback (most recent call last):
File "test.py", line 11, in
obs = env.reset()
File "/home/aicrowd/.conda/envs/minerl/lib/python3.7/site-packages/gym/wrappers/time_limit.py", line 27, in reset
return self.env.reset(**kwargs)
File "/home/aicrowd/.conda/envs/minerl/lib/python3.7/site-packages/minerl/env/_singleagent.py", line 22, in reset
multi_obs = super().reset()
File "/home/aicrowd/.conda/envs/minerl/lib/python3.7/site-packages/minerl/env/_multiagent.py", line 446, in reset
self._send_mission(self.instances[0], agent_xmls[0], self._get_token(0, ep_uid)) # Master
File "/home/aicrowd/.conda/envs/minerl/lib/python3.7/site-packages/minerl/env/_multiagent.py", line 606, in _send_mission
ok, = struct.unpack("!I", reply)
TypeError: a bytes-like object is required, not 'NoneType'

@Miffyli
Copy link
Contributor

Miffyli commented Feb 17, 2024

Hey. Could you paste exactly what command you used to install MineRL, what you run (exactly) and the full output log? We have not shared any prebuilt docker images, only the Dockerfile for building an image, but that has not been updated in a while. You should use the instructions in the README of this repo.

@CooLeee
Copy link
Author

CooLeee commented Feb 17, 2024

Hi, thanks for replying, I just built another conda environment and the error persists. I ran installation of JDK8 beforehand with :

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jd

log output

(base) coli@DESKTOP-N52K9D1:~$ conda create --name minerl
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/coli/miniconda3/envs/minerl



Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate minerl
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) coli@DESKTOP-N52K9D1:~$ conda activate minerl
(minerl) coli@DESKTOP-N52K9D1:~$ python -V
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3
(minerl) coli@DESKTOP-N52K9D1:~$ python3 -V
Python 3.10.12
(minerl) coli@DESKTOP-N52K9D1:~$ java -version
openjdk version "1.8.0_392"
OpenJDK Runtime Environment (build 1.8.0_392-8u392-ga-1~22.04-b08)
OpenJDK 64-Bit Server VM (build 25.392-b08, mixed mode)
(minerl) coli@DESKTOP-N52K9D1:~$ javac -version
javac 1.8.0_392
(minerl) coli@DESKTOP-N52K9D1:~$ pip install git+https://github.com/minerllabs/minerl --user
Collecting git+https://github.com/minerllabs/minerl
  Cloning https://github.com/minerllabs/minerl to /tmp/pip-req-build-fbm4_u21
  Running command git clone --filter=blob:none --quiet https://github.com/minerllabs/minerl /tmp/pip-req-build-fbm4_u21
  Resolved https://github.com/minerllabs/minerl to commit 8268ee99329ab45793859050d95352d35274532b
  Preparing metadata (setup.py) ... done
Collecting Pyro4>=4.76
  Downloading Pyro4-4.82-py2.py3-none-any.whl (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.0/90.0 KB 1.8 MB/s eta 0:00:00
Requirement already satisfied: coloredlogs>=10.0 in ./.local/lib/python3.10/site-packages (from minerl==1.0.0) (15.0.1)
Collecting daemoniker>=0.2.3
  Downloading daemoniker-0.2.3-py3-none-any.whl (33 kB)
Collecting dill>=0.3.1.1
  Downloading dill-0.3.8-py3-none-any.whl (116 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.3/116.3 KB 1.2 MB/s eta 0:00:00
Collecting flaky
  Downloading flaky-3.7.0-py2.py3-none-any.whl (22 kB)
Collecting gym<=0.23.1,>=0.19.0
  Downloading gym-0.23.1.tar.gz (626 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 626.2/626.2 KB 1.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting imagehash>=4.0.0
  Downloading ImageHash-4.3.1-py2.py3-none-any.whl (296 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 296.5/296.5 KB 1.3 MB/s eta 0:00:00
Collecting inflection>=0.3.1
  Downloading inflection-0.5.1-py2.py3-none-any.whl (9.5 kB)
Collecting ipython>=7.5.0
  Downloading ipython-8.21.0-py3-none-any.whl (810 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 810.0/810.0 KB 1.3 MB/s eta 0:00:00
Collecting jinja2>=2.11.2
  Downloading Jinja2-3.1.3-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.2/133.2 KB 1.2 MB/s eta 0:00:00
Collecting lxml>=4.3.3
  Downloading lxml-5.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 1.1 MB/s eta 0:00:00
Collecting numpy<1.24,>=1.16.2
  Downloading numpy-1.23.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 1.1 MB/s eta 0:00:00
Collecting opencv-python>=4.1.0.25
  Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (62.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.2/62.2 MB 1.1 MB/s eta 0:00:00
Collecting pillow>=8.0.0
  Downloading pillow-10.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 1.2 MB/s eta 0:00:00
Requirement already satisfied: psutil>=5.6.2 in ./.local/lib/python3.10/site-packages (from minerl==1.0.0) (5.9.6)
Collecting pyglet
  Downloading pyglet-2.0.10-py3-none-any.whl (858 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 858.3/858.3 KB 1.2 MB/s eta 0:00:00
Requirement already satisfied: requests>=2.20.0 in ./.local/lib/python3.10/site-packages (from minerl==1.0.0) (2.31.0)
Requirement already satisfied: setuptools>=49.2.0 in /usr/lib/python3/dist-packages (from minerl==1.0.0) (59.6.0)
Requirement already satisfied: tqdm>=4.32.2 in ./.local/lib/python3.10/site-packages (from minerl==1.0.0) (4.66.1)
Collecting typing>=3.6.6
  Downloading typing-3.7.4.3.tar.gz (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.6/78.6 KB 1.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting xmltodict==0.12.0
  Downloading xmltodict-0.12.0-py2.py3-none-any.whl (9.2 kB)
Collecting getch>=1.0
  Downloading getch-1.0.tar.gz (1.3 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: humanfriendly>=9.1 in ./.local/lib/python3.10/site-packages (from coloredlogs>=10.0->minerl==1.0.0) (10.0)
Collecting gym-notices>=0.0.4
  Downloading gym_notices-0.0.8-py3-none-any.whl (3.0 kB)
Requirement already satisfied: cloudpickle>=1.2.0 in ./.local/lib/python3.10/site-packages (from gym<=0.23.1,>=0.19.0->minerl==1.0.0) (3.0.0)
Collecting scipy
  Downloading scipy-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (38.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.4/38.4 MB 1.0 MB/s eta 0:00:00
Collecting PyWavelets
  Downloading pywavelets-1.5.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 917.5 kB/s eta 0:00:00
Collecting decorator
  Downloading decorator-5.1.1-py3-none-any.whl (9.1 kB)
Collecting pexpect>4.3
  Downloading pexpect-4.9.0-py2.py3-none-any.whl (63 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.8/63.8 KB 1.3 MB/s eta 0:00:00
Collecting pygments>=2.4.0
  Downloading pygments-2.17.2-py3-none-any.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 1.3 MB/s eta 0:00:00
Collecting jedi>=0.16
  Downloading jedi-0.19.1-py2.py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 1.2 MB/s eta 0:00:00
Collecting traitlets>=5
  Downloading traitlets-5.14.1-py3-none-any.whl (85 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.4/85.4 KB 1.3 MB/s eta 0:00:00
Collecting prompt-toolkit<3.1.0,>=3.0.41
  Downloading prompt_toolkit-3.0.43-py3-none-any.whl (386 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 386.1/386.1 KB 1.2 MB/s eta 0:00:00
Collecting matplotlib-inline
  Downloading matplotlib_inline-0.1.6-py3-none-any.whl (9.4 kB)
Requirement already satisfied: exceptiongroup in ./.local/lib/python3.10/site-packages (from ipython>=7.5.0->minerl==1.0.0) (1.2.0)
Collecting stack-data
  Downloading stack_data-0.6.3-py3-none-any.whl (24 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting serpent>=1.27
  Downloading serpent-1.41-py3-none-any.whl (9.6 kB)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.10/site-packages (from requests>=2.20.0->minerl==1.0.0) (2023.11.17)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./.local/lib/python3.10/site-packages (from requests>=2.20.0->minerl==1.0.0) (2.1.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./.local/lib/python3.10/site-packages (from requests>=2.20.0->minerl==1.0.0) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in ./.local/lib/python3.10/site-packages (from requests>=2.20.0->minerl==1.0.0) (3.6)
Collecting parso<0.9.0,>=0.8.3
  Downloading parso-0.8.3-py2.py3-none-any.whl (100 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.8/100.8 KB 1.3 MB/s eta 0:00:00
Collecting ptyprocess>=0.5
  Downloading ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Collecting executing>=1.2.0
  Downloading executing-2.0.1-py2.py3-none-any.whl (24 kB)
Collecting pure-eval
  Downloading pure_eval-0.2.2-py3-none-any.whl (11 kB)
Collecting asttokens>=2.1.0
  Downloading asttokens-2.4.1-py2.py3-none-any.whl (27 kB)
Requirement already satisfied: six>=1.12.0 in /usr/lib/python3/dist-packages (from asttokens>=2.1.0->stack-data->ipython>=7.5.0->minerl==1.0.0) (1.16.0)
Building wheels for collected packages: minerl, getch, gym, typing
  Building wheel for minerl (setup.py) ... done
  Created wheel for minerl: filename=minerl-1.0.0-cp310-cp310-linux_x86_64.whl size=1341623826 sha256=38bd3099109c5217a1460fb96008e7d3542f2c80f14d43f0ed73e57a226b724d
  Stored in directory: /tmp/pip-ephem-wheel-cache-thj4nwcu/wheels/68/84/3b/2e10aaabb68255450a40a88f79cdda9587f0669bca51383940
  Building wheel for getch (setup.py) ... done
  Created wheel for getch: filename=getch-1.0-cp310-cp310-linux_x86_64.whl size=9794 sha256=68074a7eb134b5bf7a4a85730ad64f87d481133d9813a118c8680605c92265a2
  Stored in directory: /home/coli/.cache/pip/wheels/ac/c4/98/3509ed1eea91cd925ecf8601b085d8faf13c9d5269653f4325
  Building wheel for gym (pyproject.toml) ... done
  Created wheel for gym: filename=gym-0.23.1-py3-none-any.whl size=701375 sha256=06f6df108b4bb620fdf6988f7f9100f6c1773998b20c89c060839bafb51cbab3
  Stored in directory: /home/coli/.cache/pip/wheels/1a/00/fb/fe5cf2860fb9b7bc860e28f00095a1f42c7b726dd6f42d1acc
  Building wheel for typing (setup.py) ... done
  Created wheel for typing: filename=typing-3.7.4.3-py3-none-any.whl size=26325 sha256=49d5a96e749088f9e9721f9b22e1c276cb64c500e4805a3f9ec7aa51be1fed42
  Stored in directory: /home/coli/.cache/pip/wheels/7c/d0/9e/1f26ebb66d9e1732e4098bc5a6c2d91f6c9a529838f0284890
Successfully built minerl getch gym typing
Installing collected packages: wcwidth, pyglet, pure-eval, ptyprocess, gym-notices, getch, daemoniker, xmltodict, typing, traitlets, serpent, pygments, prompt-toolkit, pillow, pexpect, parso, numpy, MarkupSafe, lxml, inflection, flaky, executing, dill, decorator, asttokens, stack-data, scipy, PyWavelets, Pyro4, opencv-python, matplotlib-inline, jinja2, jedi, gym, ipython, imagehash, minerl
  Attempting uninstall: numpy
    Found existing installation: numpy 1.26.2
    Uninstalling numpy-1.26.2:
      Successfully uninstalled numpy-1.26.2
Successfully installed MarkupSafe-2.1.5 PyWavelets-1.5.0 Pyro4-4.82 asttokens-2.4.1 daemoniker-0.2.3 decorator-5.1.1 dill-0.3.8 executing-2.0.1 flaky-3.7.0 getch-1.0 gym-0.23.1 gym-notices-0.0.8 imagehash-4.3.1 inflection-0.5.1 ipython-8.21.0 jedi-0.19.1 jinja2-3.1.3 lxml-5.1.0 matplotlib-inline-0.1.6 minerl-1.0.0 numpy-1.23.5 opencv-python-4.9.0.80 parso-0.8.3 pexpect-4.9.0 pillow-10.2.0 prompt-toolkit-3.0.43 ptyprocess-0.7.0 pure-eval-0.2.2 pyglet-2.0.10 pygments-2.17.2 scipy-1.12.0 serpent-1.41 stack-data-0.6.3 traitlets-5.14.1 typing-3.7.4.3 wcwidth-0.2.13 xmltodict-0.12.0
(minerl) coli@DESKTOP-N52K9D1:~$ pip show minerl
Name: minerl
Version: 1.0.0
Summary: MineRL environment and data loader for reinforcement learning from human demonstration in Minecraft
Home-page: http://github.com/minerllabs/minerl
Author: MineRL Labs
Author-email: minerl@andrew.cmu.edu
License: MIT
Location: /home/coli/.local/lib/python3.10/site-packages
Requires: coloredlogs, daemoniker, dill, flaky, getch, gym, imagehash, inflection, ipython, jinja2, lxml, numpy, opencv-python, pillow, psutil, pyglet, Pyro4, requests, setuptools, tqdm, typing, xmltodict
Required-by:
(minerl) coli@DESKTOP-N52K9D1:~$ vim test.py
(minerl) coli@DESKTOP-N52K9D1:~$ which xvfb-run
/usr/bin/xvfb-run
(minerl) coli@DESKTOP-N52K9D1:~$ xvfb-run python3 test.py
/home/coli/.local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.spawn
/home/coli/.local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.spawn
/usr/lib/python3.10/runpy.py:126: 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))
/home/coli/.local/lib/python3.10/site-packages/minerl/env/malmo.py:494: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self._logger_thread.setDaemon(True)
Traceback (most recent call last):
  File "/home/coli/test.py", line 5, in <module>
    obs = env.reset()
  File "/home/coli/.local/lib/python3.10/site-packages/gym/wrappers/time_limit.py", line 26, in reset
    return self.env.reset(**kwargs)
  File "/home/coli/.local/lib/python3.10/site-packages/gym/wrappers/order_enforcing.py", line 18, in reset
    return self.env.reset(**kwargs)
  File "/home/coli/.local/lib/python3.10/site-packages/minerl/env/_singleagent.py", line 22, in reset
    multi_obs = super().reset()
  File "/home/coli/.local/lib/python3.10/site-packages/minerl/env/_multiagent.py", line 446, in reset
    self._send_mission(self.instances[0], agent_xmls[0], self._get_token(0, ep_uid))  # Master
  File "/home/coli/.local/lib/python3.10/site-packages/minerl/env/_multiagent.py", line 606, in _send_mission
    ok, = struct.unpack("!I", reply)
TypeError: a bytes-like object is required, not 'NoneType'

test.py

import gym
import minerl

env = gym.make("MineRLNavigateDense-v0")
obs = env.reset()
print('done reset'+'*'*100) # the reset was never finished

@CooLeee
Copy link
Author

CooLeee commented Feb 17, 2024

Hi, just wondering if there is any available docker image with MineRL installed that we could use.

@Miffyli
Copy link
Contributor

Miffyli commented Feb 21, 2024

@CooLeee Sorry for the delay. There is no prebuilt image of MineRL itself from the MineRL team, although someone might somewhere have a prebuilt image for this. Check e.g., MineDojo.

@jjihwan
Copy link

jjihwan commented Aug 23, 2024

@CooLeee
Same error :( Did you solve this?

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

3 participants