问题描述:
遇到的问题:Running python -m pysc2.bin.agent --map Simple64 yields pygame.error: Unable to make GL context current
Setup to reproduce
OS: Ubuntu 18.04.3 LTS (bionic)
Python: Python 3.6.9
Pygame: 2.0.0.dev10
SC II Linux version: I've tried both SC2.4.9.3 and SC2.4.10; I'm still running into the below error.
I'm running this within a docker container. My base docker image is nvidia/cudagl:10.1-devel-ubuntu18.04; I can confirm that other OpenGL applications run and display with no issues (e.g., glxgears).
As mentioned in the title, running the command:
python -m pysc2.bin.agent --map Simple64
yields the following error:
~/c/h/g/g/scripts ❯❯❯ python -m pysc2.bin.agent --map Simple64 [113/163]
pygame 2.0.0.dev10 (SDL 2.0.12, python 3.6.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
I0709 14:24:37.838358 140086587701056 sc_process.py:135] Launching SC2: /home/karthik/StarCraftII/Versions/Base75689/SC2_x64 -listen 127.0.0.1 -port 15922 -dataDir /home/karthik/StarCraftII/ -tempDir /tmp/sc-3chexyvb/
I0709 14:24:37.842911 140086587701056 remote_controller.py:167] Connecting to: ws://127.0.0.1:15922/sc2api, attempt: 0, running: True
Version: B75689 (SC2.4.10)
Build: Aug 12 2019 17:16:57
Command Line: '"/home/karthik/StarCraftII/Versions/Base75689/SC2_x64" -listen 127.0.0.1 -port 15922 -dataDir /home/karthik/StarCraftII/ -tempDir /tmp/sc-3chexyvb/'
Starting up...
Startup Phase 1 complete
I0709 14:24:38.846137 140086587701056 remote_controller.py:167] Connecting to: ws://127.0.0.1:15922/sc2api, attempt: 1, running: True
Startup Phase 2 complete
Creating stub renderer...
Listening on: 127.0.0.1:15922
Startup Phase 3 complete. Ready for commands.
I0709 14:24:39.848195 140086587701056 remote_controller.py:167] Connecting to: ws://127.0.0.1:15922/sc2api, attempt: 2, running: True
ConnectHandler: Request from 127.0.0.1:53028 accepted
ReadyHandler: 127.0.0.1:53028 ready
Requesting to join a single player game
Configuring interface options
Configure: raw interface enabled
Configure: feature layer interface enabled
Configure: score interface enabled
Configure: render interface disabled
Launching next game.
Next launch phase started: 2
Next launch phase started: 3
Next launch phase started: 4
Next launch phase started: 5
Next launch phase started: 6
Next launch phase started: 7
Next launch phase started: 8
Game has started.
Using default stable ids, none found at: /home/karthik/StarCraftII/stableid.json
Successfully loaded stable ids: GameData\stableid.json
Sending ResponseJoinGame
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
I0709 14:24:45.184752 140086587701056 sc2_env.py:314] Environment is ready
I0709 14:24:45.185098 140086587701056 sc2_env.py:507] Starting episode 1: [random, random] on Simple64
0/no_op ()
1/move_camera (1/minimap [64, 64])
2/select_point (6/select_point_act [4]; 0/screen [84, 84])
3/select_rect (7/select_add [2]; 0/screen [84, 84]; 2/screen2 [84, 84])
4/select_control_group (4/control_group_act [5]; 5/control_group_id [10])
Exception in thread Renderer:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.6/dist-packages/PySC2-3.0.0-py3.6.egg/pysc2/lib/renderer_human.py", line 1706, in render_thread
self.render_obs(obs)
File "/usr/local/lib/python3.6/dist-packages/PySC2-3.0.0-py3.6.egg/pysc2/lib/renderer_human.py", line 69, in _with_lock
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/PySC2-3.0.0-py3.6.egg/pysc2/lib/stopwatch.py", line 212, in _stopwatch
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/PySC2-3.0.0-py3.6.egg/pysc2/lib/renderer_human.py", line 1735, in render_obs
pygame.display.flip()
pygame.error: Unable to make GL context current
解决方案:
解决方案:
pip uninstall pygame
pip install pygame==1.9.6
成功结果:
成功结果: