araffin / rl-baselines-zoo

A collection of 100+ pre-trained RL agents using Stable Baselines, training and hyperparameter optimization included.
https://stable-baselines.readthedocs.io/
MIT License
1.13k stars 208 forks source link

Docker image requires python3-tk package #17

Closed hcv1027 closed 5 years ago

hcv1027 commented 5 years ago

I'm trying to use your docker image araffin/rl-baselines-zoo-cpu When I typed the command:

./run_docker_cpu.sh python train.py --algo ppo2 --env CartPole-v1

It shows below error log

Executing in the docker (cpu image):
python train.py --algo ppo2 --env CartPole-v1
+ export DISPLAY=:1
+ Xvfb :1 -screen 0 1024x768x24
+ DISPLAY=:1
+ display=1
+ file=/tmp/.X11-unix/X1
+ sleep 1
++ seq 1 10
+ for i in '$(seq 1 10)'
+ '[' -e /tmp/.X11-unix/X1 ']'
+ break
+ '[' -e /tmp/.X11-unix/X1 ']'
+ exec bash -c 'cd /root/code/stable-baselines/ && python train.py --algo ppo2 --env CartPole-v1'
/root/venv/lib/python3.5/site-packages/gym/envs/registration.py:64: UserWarning: register(timestep_limit=1000) is deprecated. Use register(max_episode_steps=1000) instead.
  warnings.warn("register(timestep_limit={}) is deprecated. Use register(max_episode_steps={}) instead.".format(timestep_limit, timestep_limit))
Traceback (most recent call last):
  File "/usr/lib/python3.5/tkinter/__init__.py", line 36, in <module>
    import _tkinter
ImportError: No module named '_tkinter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 11, in <module>
    from stable_baselines.common import set_global_seeds
  File "/root/venv/lib/python3.5/site-packages/stable_baselines/__init__.py", line 6, in <module>
    from stable_baselines.gail import GAIL
  File "/root/venv/lib/python3.5/site-packages/stable_baselines/gail/__init__.py", line 2, in <module>
    from stable_baselines.gail.dataset.dataset import ExpertDataset, DataLoader
  File "/root/venv/lib/python3.5/site-packages/stable_baselines/gail/dataset/dataset.py", line 8, in <module>
    import matplotlib.pyplot as plt
  File "/root/venv/lib/python3.5/site-packages/matplotlib/pyplot.py", line 2372, in <module>
    switch_backend(rcParams["backend"])
  File "/root/venv/lib/python3.5/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/root/venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/root/venv/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "/root/venv/lib/python3.5/site-packages/matplotlib/backends/_backend_tk.py", line 5, in <module>
    import tkinter as Tk
  File "/usr/lib/python3.5/tkinter/__init__.py", line 38, in <module>
    raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package

Then I start a new docker container docker run -it -v araffin/rl-baselines-zoo-cpu And then I installed python3-tk by console. After this step, I can run python enjoy.py --algo a2c --env BreakoutNoFrameskip-v4 --folder trained_agents/ -n 5000 in docker bash.

araffin commented 5 years ago

Hi, Thanks for reporting the issue, this is because of the new version of stable-baselines, I recommend you to checkout the add-trpo branch (I fixed this issue in https://github.com/araffin/rl-baselines-zoo/commit/c84d4cde381870996340527d8efaa77f928bdf8b and https://github.com/araffin/rl-baselines-zoo/commit/185249b3d2b5a248e90489fdc6526941a5564c49)

araffin commented 5 years ago

Hello, This was fixed in stable baselines master ;) (see PR https://github.com/hill-a/stable-baselines/pull/268)

araffin commented 5 years ago

Now fixed in the docker version.