OpenAI Gym toolkit provides easy visualisation tools to experiment with reinforcement learning algorithms. Here I will explain the process of setting it up and the issues I have faced.
Installation instructions are given in the github page. While I was trying in the default terminal I was getting issues with python dependencies and different versions of packages installed in the system. So I tried with a virtual environment to set up gym. First, I have added the Anacaonda path to create a virtual environment.
export PATH="/<installation path>/anaconda3/bin:$PATH"
create virtual environment.
conda create -n py34 python=3.4 source activate py34
git clone https://github.com/openai/gym.git cd gym pip install -e .
This will install gym, if you are getting error saying swig not found. Install the dependencies,
sudo apt-get install python python-setuptools python-dev python-augeas gcc swig dialog
Run the sample program.
python >import gym >env = gym.make('LunarLander-v2') >env.reset() >env.render()
If everything is installed correctly, It will render this frame,
If there is an error regarding Box2D library, install it manually.
pip3 uninstall Box2D box2d-py git clone https://github.com/pybox2d/pybox2d cd pybox2d/ python setup.py clean python setup.py build python setup.py install
OpenAI gym needs OpenGL drivers to be configured in the machine. I have got issues with nvidia driver (nvidia-smi). So I tried switching to an older driver. This can be done through ‘Software Updater->Additional Drivers’.
OpenGl driver can be tested by running glxgears in terminal. If installed correctly, it shows up this image with animation.
#mujoco export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/kiran/.mujoco/mjpro150/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia-390 #If there is OpenGL error export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/nvidia-390/libGL.so