Installation problem before applying reinforce agent

Hello everyone,
I am new to TensorFlow and I want to use reinforce agent codes. Before that, I need to install the followings:
sudo apt-get update
sudo apt-get install -y xvfb ffmpeg
pip install ‘imageio==2.4.0’

I tried to install them in a Jupyter cell, Anaconda prompt and Command prompt but it was unsuccessful. I get syntax error as “Invalid syntax”. Could you please help me and let me know how to fix this problem?
Thank you.

Hi F_J,

I’ve just tried on colab and it works like this (I tried one line per cell):

!apt-get update
!apt-get install -y xvfb ffmpeg
!pip install imageio==2.4.0
1 Like

The REINFORCE tutorial is for Google Colab, which runs on the Cloud. You are recommended to use it to utilize the free GPU acceleration (for a number of hours) and the setup simplicity, since deep RL can be compute intensive and sample-inefficient (see Reinforcement learning, fast and slow by DeepMind’s Matthew Botvinick et al., 2019).

If you’re running the notebook locally:

  • On a Linux machine, you might also need to add x11-utils:
!apt-get install -y xvfb x11-utils
!apt-get install -y ffmpeg

The xvfb and ffmpeg dependencies are needed for video playback to watch the replays of your RL agent. “Xvfb (X virtual framebuffer) is a display server implementing the X11 display server protocol. It runs in memory and does not require a physical display. Only a network layer is necessary.” (source). (For more information, you can read about X virtual frame buffer/xvfb and FFmpeg. You can also read about X11.)

Regarding this step:

If you use back ticks, make sure you use ' and not or . No back ticks should work, as @lgusm mentioned here:

You may find this post useful: Rendering OpenAi Gym in Google Colaboratory. – StarAi – StarAi Applied Research Blog

1 Like

Thank you. !pip install imageio==2.4.0 worked. But, the first two lines are not still run.

Thank you for your explanations and information. They are very useful.