Search code examples
pythonstarcraftgym

pysc2 Starcraft - obs.observation returns KeyError


I am trying to run various codes I found in the internet with pysc2 Starcraft DeepMind AI agents. I often run into KeyError: 'SOME-VALUE-HERE' invoked by obs.observation["SOME-VALUE-HERE"].

For example this agent and this agent crash on KeyError: 'minimap' invoked by obs.observation['minimap'].

Other example is KeyError: 'screen' invoked by observation["screen"] when running Siraj Raval's enjoy_mineral_shards script.

It is very frustrating as I have not found anybody else running to this error and I really struggle with debugging in pysc2 environment. Any help?


Solution

  • The codes were run with pysc2 version 2.0.1. One needs to downgrade to version 1.2 (relevant for mentioned examples).

    pip install pysc2==1.2 
    

    (many thanks to discordapp Starcraft 2 AI community).