Closed PauloVanHuffel closed 6 years ago
Same here...
In meanwhile you can edit site-packages/pysc2/run_configrs/init.py
after FLAGS = flags.FLAGS insert
import sys FLAGS(sys.argv)
I am using windows btw
Okay, I got it. This repo uses gflags library, where pysc2 uses absl flags library. Inf your program You just have to set:
if name == 'main': import sys from absl import flags FLAGS = flags.FLAGS FLAGS(sys.argv) main()
I had the same issue, when trying to execute one of the pysc2-examples. Changing the gflags library to the absl one fixed this for me. So what I did was:
Replace the line
import gflags as flags
with
import absl as flags
I also got a "All arguments must be passed as keyword arguments." error. This was fixed by changing:
with sc2_env.SC2Env(
"CollectMineralShards",
step_mul=step_mul,
visualize=True,
game_steps_per_episode=steps * step_mul) as env:
to
with sc2_env.SC2Env(
map_name="CollectMineralShards",
step_mul=step_mul,
visualize=True,
game_steps_per_episode=steps * step_mul) as env:
Anyone got a clue why this is? Couple months ago it did work out of the box for me. This time I had to change the example code. Please clarify if you know :)
I believe that I'm still having this issue, even with the fix.
$ /c/Python36/python train_mineral_shards.py --algorithm=acktr
algorithm : acktr
timesteps : 2000000
exploration_fraction : 0.5
prioritized : True
dueling : True
num_cpu : 4
lr : 0.0005
Process Process-2:
Traceback (most recent call last):
File "C:\Python36\lib\multiprocessing\process.py", line 249, in _bootstrap
self.run()
File "C:\Python36\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\GeorgeNychis\Documents\src\sc2\pysc2-examples\common\vec_env\subproc_vec_env.py", line 14, in worker
map_name=map_name
File "c:\users\georgenychis\documents\src\sc2\pysc2\pysc2\env\sc2_env.py", line 132, in __init__
self._setup((agent_race, bot_race, difficulty), **kwargs)
File "c:\users\georgenychis\documents\src\sc2\pysc2\pysc2\env\sc2_env.py", line 173, in _setup
self._run_config = run_configs.get()
File "c:\users\georgenychis\documents\src\sc2\pysc2\pysc2\run_configs\__init__.py", line 38, in get
if FLAGS.sc2_run_config is None: # Find the highest priority as default.
File "C:\Python36\lib\site-packages\absl\flags\_flagvalues.py", line 509, in __getattr__
raise _exceptions.UnparsedFlagAccessError(error_message)
absl.flags._exceptions.UnparsedFlagAccessError: Trying to access flag --sc2_run_config before flags were parsed.
@gnychis Ran into the same issue, even with the recent changes.
Rectified it by doing the following:
Edit the following in pysc2\run_configs__init__.py (N.B: I'm using Anaconda, so you will need to find the location of pysc2)
From this (Line 25 to 27): flags.DEFINE_string("sc2_run_config", None, "Which run_config to use to spawn the binary.") FLAGS = flags.FLAGS
To this: flags.DEFINE_string("sc2_run_config", None, "Which run_config to use to spawn the binary.") FLAGS = flags.FLAGS
import sys FLAGS(sys.argv)
A bit of a hack I know, however I've only just became acquainted with the project so I'm trying to find the root cause. Hopefully of some help.
@AGreatPigeon works for me! Thank you!
@AGreatPigeon Works, thank you!
@AGreatPigeon Works! thanks
I get this error when running any of the scripts. I cant seem to get this fixed. Maybe its a problem with pysc2 itself?