llSourcell/A-Guide-to-DeepMinds-StarCraft-AI-Environment

Getting code running on Windows 10, latest PySC2

4OH4 opened this issue · 2 comments

4OH4 commented

I've just got this to work on Windows 10, it took a bit of effort but here are the steps I took in case it helps anyone else:

I'm using Anaconda, so created a new environment and installed tensorflow:

conda create --name starcraft python=3.6 anaconda
activate starcraft
pip install tensorflow

Followed these instructions: https://github.com/j8lp/atari-py to install MSYS2, atari-py and OpenAI gym. Doing this first was required to get baselines (next) to install properly.

Install baselines from sources, with a mod to the setup.py script to remove references to mujoco (it is not free open source):
git clone https://github.com/openai/baselines.git
Open up baselines/setup.py in a text editor.
Locate the line containing gym[mujoco,atari,classic_control,robotics]
Delete mujoco, resulting in gym[atari,classic_control,robotics]
Save setup.py and close.
python setup.py install

Install PySC2 package, but then make a mod to the code:
pip install pysc2
Locate the pysc2\run_configs\__init__.py file. In my anaconda install it was at:
envs\<my-environment-name>\Lib\site-packages\pysc2\run_configs\__init__.py:
Insert at L28:

import sys
FLAGS(sys.argv)

Install gflags package from sources:

git clone https://github.com/google/python-gflags.git
cd python-gflags
python setup.py install

Download the example code (this repository) and then make some changes:
git clone https://github.com/llSourcell/A-Guide-to-DeepMinds-StarCraft-AI-Environment.git
I think a change in PySC2 now requires you to only use keyword arguments when creating the environment. In train_mineral_shards.py (line 22) and enjoy_mineral_shards.py (line 36)
Change:

"CollectMineralShards",

to:

map_name="CollectMineralShards",

It also looks like some of the utility functions have moved. In enjoy_mineral_shards.py and deepq_mineral_shards.py, add somewhere at the top:

import baselines.deepq.utils as U2

Change all: U.BatchInput, U.load_state, U.save_state
to: U2.BatchInput, U2.load_state, U2.save_state

Then you should be able to run the example code with:

python enjoy_mineral_shards.py

Refs:
openai/baselines#291
chris-chris/pysc2-examples#5
chris-chris/pysc2-examples#13

4OH4 commented

Marking as closed as for information only

So question about Insert at L28:
There is already a line of code here so what to do?
Line 28 reads:
FLAGS = flags.FLAGS