Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker instance bad run command file #157

Open
Sithael opened this issue Dec 6, 2023 · 0 comments
Open

Docker instance bad run command file #157

Sithael opened this issue Dec 6, 2023 · 0 comments

Comments

@Sithael
Copy link

Sithael commented Dec 6, 2023

Hello, I've been recently trying to create my own project involving dockerization of SMAC na PYSC2. But unfortunately I've got some issue that I struggle to solve.

  1. Error code

[2023-12-06 13:26:53] [INFO] - Launching SC2: /marl/games/StarCraftII/Versions/Base59877/SC2_x64 -listen 127.0.0.1 -port 41453 -dataDir /marl/games/StarCraftII/ -tempDir /tmp/sc-k561g_5y/
[2023-12-06 13:26:53] [INFO] - Connecting to: ws://127.0.0.1:41453/sc2api, attempt: 0, running: True
Version: B59877 (SC2.4.0)
Build: Nov 27 2017 21:52:46
Command Line: '"/marl/games/StarCraftII/Versions/Base59877/SC2_x64" /marl/games/StarCraftII/Versions/Base59877/SC2_x64 -listen 127.0.0.1 -port 41453 -dataDir /marl/games/StarCraftII/ -tempDir /tmp/sc-k561g_5y/'
Starting up...
Startup Phase 1 complete
[2023-12-06 13:26:54] [INFO] - Connecting to: ws://127.0.0.1:41453/sc2api, attempt: 1, running: True
Startup Phase 2 complete
Creating stub renderer...
Listening on: 127.0.0.1:41453 (41453)
Fatal Error:
Bad run command file.
Terminating...
[2023-12-06 13:26:55] [WARNING] - SC2 isn't running, so bailing early on the websocket connection.
[2023-12-06 13:26:55] [INFO] - Shutdown gracefully.
[2023-12-06 13:26:55] [INFO] - Shutdown with return code: -15
Error executing job with overrides: []
Traceback (most recent call last):
File "/marl/src/tune.py", line 88, in
runner()
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/main.py", line 94, in decorated_main
_run_hydra(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/utils.py", line 394, in _run_hydra
_run_app(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/utils.py", line 457, in _run_app
run_and_report(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/utils.py", line 223, in run_and_report
raise ex
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/utils.py", line 220, in run_and_report
return func()
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/utils.py", line 458, in
lambda: hydra.run(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/_internal/hydra.py", line 132, in run
_ = ret.return_value
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/core/utils.py", line 260, in return_value
raise self._return_value
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/hydra/core/utils.py", line 186, in run_job
ret.return_value = task_function(task_cfg)
File "/marl/src/tune.py", line 84, in runner
tuner.optimize(n_rollouts, eval_schedule, checkpoint_freq, eval_n_games)
File "/marl/src/tuner/core_tuner.py", line 366, in optimize
self._evaluator.evaluate(rollout=rollout, n_games=eval_n_games)
File "/marl/src/evaluator/core_evaluator.py", line 76, in evaluate
self.reset()
File "/marl/src/evaluator/core_evaluator.py", line 69, in reset
self._env.reset()
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 403, in reset
self._launch()
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 323, in _launch
self._sc2_proc = self._run_config.start(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/run_configs/platforms.py", line 200, in start
return super(Linux, self).start(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/run_configs/platforms.py", line 83, in start
return sc_process.StarcraftProcess(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/lib/sc_process.py", line 137, in init
self._controller = remote_controller.RemoteController(
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 142, in init
sock = self._connect(host, port, proc, timeout_seconds)
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/lib/stopwatch.py", line 205, in _stopwatch
return func(*args, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/marl-engineering-vP2xYT9u-py3.9/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 176, 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?

  1. SC2 installation script

TARGET_DIR=$(pwd)/games

echo 'Installing StarCraft II in the working directory...'

if [ ! -d $TARGET_DIR ]; then
echo 'StarCraftII is not installed. Installing now...'
# Create the StarCraftII directory
mkdir -p $TARGET_DIR
# Download the StarCraftII package
wget -q http://blzdistsc2-a.akamaihd.net/Linux/SC2.4.0.2.zip
# Unzip the package into the StarCraftII directory
unzip -P iagreetotheeula SC2.4.0.2.zip -d $TARGET_DIR
# Remove the downloaded zip file to clean up
rm SC2.4.0.2.zip
else
echo 'StarCraftII is already installed.'
fi

echo 'StarCraft II is installed in: '$TARGET_DIR

echo 'Installing SMAC maps...'

MAP_DIR="$TARGET_DIR/StarCraftII/Maps"
echo 'MAP_DIR is set to '$MAP_DIR

if [ ! -d $MAP_DIR ]; then
mkdir -p $MAP_DIR
fi

wget https://github.com/oxwhirl/smac/releases/download/v0.1-beta1/SMAC_Maps.zip
unzip SMAC_Maps.zip -d $MAP_DIR
rm SMAC_Maps.zip

echo 'Downloading additional StarCraft II Maps...'

wget -q https://github.com/deepmind/pysc2/releases/download/v1.2/mini_games.zip
wget -q http://blzdistsc2-a.akamaihd.net/MapPacks/Melee.zip
wget -q http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season3.zip
wget -q http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season2.zip
wget -q http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2017Season1.zip

unzip mini_games.zip -d $MAP_DIR
unzip -P iagreetotheeula Melee.zip -d $MAP_DIR
unzip -P iagreetotheeula Ladder2017Season3.zip -d $MAP_DIR
unzip -P iagreetotheeula Ladder2017Season2.zip -d $MAP_DIR
unzip -P iagreetotheeula Ladder2017Season1.zip -d $MAP_DIR

rm mini_games.zip
rm Melee.zip
rm Ladder2017Season3.zip
rm Ladder2017Season2.zip
rm Ladder2017Season1.zip

echo 'StarCraft II and all maps are installed.'

  1. Dockerfile

FROM --platform=linux/amd64 nvidia/cuda:12.3.0-runtime-ubuntu22.04
LABEL maintainer="James Chojnacki"

ENV DEBIAN_FRONTEND=noninteractive

ENV TZ=Etc/UTC

RUN apt-get update -y &&
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:deadsnakes/ppa &&
apt-get update -y && apt-get upgrade -y &&
apt-get install -y apt-utils vim man build-essential wget sudo &&
apt-get install -y python3.9 python3.9-dev python3.9-distutils &&
apt-get install -y swig gcc git curl unzip &&
rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1

RUN curl -sSL -o install-poetry.py https://install.python-poetry.org &&
python3 install-poetry.py --yes &&
rm install-poetry.py

ENV PATH="$PATH:/root/.local/bin"

RUN ls /root/.local/bin/poetry

COPY . /marl

WORKDIR /marl

SHELL ["/bin/bash", "-c"]

RUN chmod +x activate_env.sh install_sc2.sh

RUN ./install_sc2.sh

RUN ./activate_env.sh

ENV SC2PATH /marl/games/StarCraftII

Has anyone bumped into similar issue?

@Sithael Sithael changed the title Docker instance issue Docker instanced bad run command file Dec 6, 2023
@Sithael Sithael changed the title Docker instanced bad run command file Docker instance bad run command file Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant