---
# System prepended metadata

title: DMLAB

---

# DMLAB Installation
https://github.com/deepmind/lab/tree/master/python/pip_package
## Create Container
```
cd ct2_train
podman run -d -v $PWD/train_volume:/root -w /root --name=dmlab -it ct3_release tmux
podman exec -it dmlab tmux a
```
## Install Bazel
https://bazel.build/install/ubuntu?hl=zh-tw
```
apt install apt-transport-https curl gnupg -y
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
mv bazel-archive-keyring.gpg /usr/share/keyrings
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
apt update
apt install bazel
```
## Install Dependencies
```
apt-get install libffi-dev gettext freeglut3-dev libsdl2-dev zip libosmesa6-dev python-dev python-numpy python-pil python-enum34 python3-dev python3-numpy python3-pil
```
## Install
```
git clone https://github.com/deepmind/lab.git && cd lab
echo -e "build --cxxopt=-std=c++14\nbuild --host_cxxopt=-std=c++14" > .bazelrc
bazel build -c opt --python_version=PY3 //python/pip_package:build_pip_package
./bazel-bin/python/pip_package/build_pip_package /tmp/dmlab_pkg
pip install /tmp/dmlab_pkg/deepmind_lab-1.0-py3-none-any.whl --force-reinstall
pip install dm-env
```

## Run Testing
vim test_agent.py
```
import deepmind_lab
import numpy as np

# Create a new environment object.
lab = deepmind_lab.Lab("demos/extra_entities", ['RGB_INTERLEAVED'],
                       {'fps': '30', 'width': '80', 'height': '60'})
lab.reset(seed=1)

# Execute 100 walk-forward steps and sum the returned rewards from each step.
print(sum(
    [lab.step(np.array([0,0,0,1,0,0,0], dtype=np.intc)) for i in range(0, 100)]))
```
python test_agent.py

![](https://hackmd.io/_uploads/BkRI2sbTn.png)

