google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
8.03k stars 1.16k forks source link

Failed to connect to the SC2 websocket. Is it up? #294

Open HuihuiTong opened 4 years ago

HuihuiTong commented 4 years ago

I want to know what makes this Error. Also, have anther problem, "/StarCraftII/Versions/Base75689/SC2_x64: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by ~/StarCraftII/Libs/libstdc++.so.6)" the version of pysc2 is 3.0.0 and StarCraft is 4.10, and in Linux.

KingKeet commented 4 years ago

It's trying to connect to Blizzard servers, which isn't necessary if all you're doing is running some bots.

I usually just hit cancel if it takes too long and it works every time.

SJTUwbl commented 4 years ago

查看上一条报错信息,如果是SC2没有运行的话,首先要运行SC2

Haoo9988 commented 4 years ago

查看上一条报错信息,如果是SC2没有运行的话,首先要运行SC2

你好,请问怎么运行SC2,可以解答一下吗?

SJTUwbl commented 4 years ago

查看上一条报错信息,如果是SC2没有运行的话,首先要运行SC2

你好,请问怎么运行SC2,可以解答一下吗?

有报错信息吗?

Haoo9988 commented 4 years ago

查看上一条报错信息,如果是SC2没有运行的话,首先要运行SC2

你好,请问怎么运行SC2,可以解答一下吗?

有报错信息吗?

/home/user/SMAC/StarCraftII/Versions/Base75689/SC2_x64: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/user/SMAC/StarCraftII/Libs/libstdc++.so.6)
WARNING:absl:SC2 isn't running, so bailing early on the websocket connection.
Traceback (most recent call last):
  File "/home/user/.conda/envs/_torch/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/user/.conda/envs/_torch/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/examples/random_agents.py", line 43, in <module>
    main()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/examples/random_agents.py", line 19, in main
    env.reset()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/env/starcraft2/starcraft2.py", line 347, in reset
    self._launch()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/env/starcraft2/starcraft2.py", line 297, in _launch
    self._sc2_proc = self._run_config.start(window_size=self.window_size, want_rgb=False)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/run_configs/platforms.py", line 205, in start
    want_rgb=want_rgb, extra_args=extra_args, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/run_configs/platforms.py", line 88, in start
    self, exec_path=exec_path, version=self.version, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/sc_process.py", line 143, in __init__
    self._host, self._port, self, timeout_seconds=timeout_seconds)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 146, in __init__
    sock = self._connect(host, port, proc, timeout_seconds)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/stopwatch.py", line 212, in _stopwatch
    return func(*args, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 180, in _connect
    raise ConnectError("Failed to connect to the SC2 websocket. Is it up?")
pysc2.lib.remote_controller.ConnectError: Failed to connect to the SC2 websocket. Is it up?
SJTUwbl commented 4 years ago

查看上一条报错信息,如果是SC2没有运行的话,首先要运行SC2

你好,请问怎么运行SC2,可以解答一下吗?

有报错信息吗?

/home/user/SMAC/StarCraftII/Versions/Base75689/SC2_x64: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/user/SMAC/StarCraftII/Libs/libstdc++.so.6)
WARNING:absl:SC2 isn't running, so bailing early on the websocket connection.
Traceback (most recent call last):
  File "/home/user/.conda/envs/_torch/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/user/.conda/envs/_torch/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/examples/random_agents.py", line 43, in <module>
    main()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/examples/random_agents.py", line 19, in main
    env.reset()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/env/starcraft2/starcraft2.py", line 347, in reset
    self._launch()
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/smac/env/starcraft2/starcraft2.py", line 297, in _launch
    self._sc2_proc = self._run_config.start(window_size=self.window_size, want_rgb=False)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/run_configs/platforms.py", line 205, in start
    want_rgb=want_rgb, extra_args=extra_args, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/run_configs/platforms.py", line 88, in start
    self, exec_path=exec_path, version=self.version, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/sc_process.py", line 143, in __init__
    self._host, self._port, self, timeout_seconds=timeout_seconds)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 146, in __init__
    sock = self._connect(host, port, proc, timeout_seconds)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/stopwatch.py", line 212, in _stopwatch
    return func(*args, **kwargs)
  File "/home/user/.conda/envs/_torch/lib/python3.6/site-packages/pysc2/lib/remote_controller.py", line 180, in _connect
    raise ConnectError("Failed to connect to the SC2 websocket. Is it up?")
pysc2.lib.remote_controller.ConnectError: Failed to connect to the SC2 websocket. Is it up?

打开你的StarCraftII/Versions/Base75689文件夹,看一下SC2_x64文件是否是可可执行文件(le -l),如果不是的话,通过chmod 777 SC2_x64更改下权限即可。

guanjiayi commented 2 years ago

@SJTUwbl 你好,遇到同样的问题,已确认SC2_x64有权限。但是还是程序仍然提示错误。

raise ConnectError("Failed to connect to the SC2 websocket. Is it up?") 
pysc2.lib.remote_controller.ConnectError: Failed to connect to the SC2 websocket. Is it up?   
pysc2.lib.remote_controller.ConnectError: Failed to connect to the SC2 websocket. Is it up?
GEYOUR commented 2 years ago

Just for reference, I solved the problem in Colab using code below:

!wget http://blzdistsc2-a.akamaihd.net/Linux/SC2.4.6.2.69232.zip
!unzip -P iagreetotheeula "./SC2.4.6.2.69232.zip"
!echo $LD_PRELOAD
!apt-get remove libtcmalloc*
! ../root/StarCraftII/Versions/Base69232/SC2_x64 --listen 127.0.0.1 --port 9999

If SC2 start successfully, the output of the last command may give you a hit, then there should be no problem.