iglu-contest / iglu

gym environment for NeurIPS 21' IGLU competition (Should NOT be used for IGLU 2022!)
https://www.iglu-contest.net/
5 stars 8 forks source link

For some reason, I cannot run the program on Ubuntu 20.04 with CUDA 11.4 #15

Closed Sino-Huang closed 2 years ago

Sino-Huang commented 2 years ago

Greeting. My environment is Ubuntu 20.04.3 LTS RTX 3090 NVIDIA-SMI 470.86 Driver Version: 470.86 CUDA Version: 11.4 cudnn8 I tried to run this program on my local machine, and then I encounter KeyError

(iglu_env437) ➜  iglu git:(master) ✗ python test/test_env.py   
/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/gym/logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/gym/logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
action space: Dict(attack:Discrete(2), back:Discrete(2), camera:Box(low=-180.0, high=180.0, shape=(2,)), forward:Discrete(2), hotbar:Discrete(7), jump:Discrete(2), left:Discrete(2), right:Discrete(2), use:Discrete(2))
observation space: Dict(agentPos:Box(low=-180.0, high=180.0, shape=(5,)), chat:<iglu.handlers.String object at 0x7fb573945890>, compass:Dict(angle:Box(low=-180.0, high=180.0, shape=())), grid:Box(low=0.0, high=6.0, shape=(9, 11, 11)), inventory:Box(low=0.0, high=20.0, shape=(6,)), pov:Box(low=0, high=255, shape=(64, 64, 3)), ray:<iglu.handlers.String object at 0x7fb573c09f50>)
current task: None
/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/gym/logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/gym/logger.py:34: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize("%s: %s" % ("WARN", msg % args), "yellow"))
/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/runpy.py:125: RuntimeWarning: 'minerl_patched.utils.process_watcher' found in sys.modules after import of package 'minerl_patched.utils', but prior to execution of 'minerl_patched.utils.process_watcher'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
72it [00:00, 125.10it/s]No pitch observation! Yielding default value 0.0 for pitch
No xpos observation! Yielding default value 0.0 for xpos
No yaw observation! Yielding default value 0.0 for yaw
No ypos observation! Yielding default value 0.0 for ypos
No zpos observation! Yielding default value 0.0 for zpos
Traceback (most recent call last):
  File "test/test_env.py", line 24, in <module>
    obs, reward, done, info = env.step(action)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/gym/wrappers/time_limit.py", line 18, in step
    observation, reward, done, info = self.env.step(action)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/iglu-0.2.2-py3.7.egg/iglu/env.py", line 185, in step
    obs, reward, done, info = super().step(action)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/env/_singleagent.py", line 32, in step
    obs, rew, done, info = super().step(multi_agent_action)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/env/_multiagent.py", line 308, in step
    out_obs, monitor = self._process_observation(actor_name, obs, _malmo_json)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/env/_multiagent.py", line 217, in _process_observation
    obs_dict[h.to_string()] = h.from_hero(info)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/handlers/translation.py", line 126, in from_hero
    for h in self.handlers
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/handlers/translation.py", line 126, in <dictcomp>
    for h in self.handlers
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/handlers/translation.py", line 91, in from_hero
    return self.walk_dict(hero_dict, self.hero_keys)
  File "/home/sukai/anaconda3/envs/iglu_env437/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/handlers/translation.py", line 80, in walk_dict
    raise KeyError()
KeyError

Not sure what caused this. But I can successfully run the program on docker container. I think the only difference is that the container is based on nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04

Sino-Huang commented 2 years ago

Hi, A new error message came out when I tried to build Docker manually

➜  iglu git:(master) ✗ docker run --network host --rm -it -v $(pwd):/root/iglu_dev iglu_env python iglu_dev/test/test_env.py
Traceback (most recent call last):
  File "iglu_dev/test/test_env.py", line 2, in <module>
    import minerl_patched
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/__init__.py", line 7, in <module>
    import minerl_patched.herobraine.envs
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/envs.py", line 19, in <module>
    MINERL_TREECHOP_V0 = Treechop()
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_specs/treechop_specs.py", line 44, in __init__
    **kwargs)
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_specs/simple_embodiment.py", line 34, in __init__
    super().__init__(name, *args, **kwargs)
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_spec.py", line 38, in __init__
    self.reset()
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_spec.py", line 44, in reset
    self.actionables = self.create_actionables()
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_specs/simple_embodiment.py", line 47, in create_actionables
    handlers.KeybasedCommandAction(k, v) for k, v in INVERSE_KEYMAP.items()
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/env_specs/simple_embodiment.py", line 48, in <listcomp>
    if k in SIMPLE_KEYBOARD_ACTION
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/handlers/agent/actions/keyboard.py", line 60, in __init__
    super().__init__(command, spaces.Discrete(len(keys) + 1))
  File "/root/miniconda/envs/py37/lib/python3.7/site-packages/minerl_patched-0.1.0-py3.7-linux-x86_64.egg/minerl_patched/herobraine/hero/spaces.py", line 206, in __init__
    self.shape = ()
AttributeError: can't set attribute

So, this means that the it's not about OS or CUDA, I think something wrong with the current dependencies.

artemZholus commented 2 years ago

Hi, wrt the second error, make sure you are using gym==0.18.3.

Sino-Huang commented 2 years ago

Hi, wrt the second error, make sure you are using gym==0.18.3.

yes, only the first error remained after I switched to gym==0.18.3

artemZholus commented 2 years ago

should be fixed now. pls check