Spinning Up requires Python3,OpenAI Gym,and OpenMPI.

Spinning Up is currently only supported on Linux and OSX.It may be possible to install on Windows,though this hasn't been extensively tested.[1]

You Should Know

Many examples and benchmarks in Spinning Up refer to RL environments that use theMuJoCophysics engine.MuJoCo is a proprietary software that requires a license,which is free to trial and free for students,but otherwise is not free.As a result,installing it is optional,but because of its importance to the research community—it is the de facto standard for benchmarking betway电竞deep RL algorithms in continuous control—it is preferred.

Don't worry if you decide not to install MuJoCo,though.You can definitely get started in RL by running RL algorithms on theClassic ControlandBox2denvironments in Gym,which are totally free to use.

[1] It looks like at least one person has figured outa workaround for running on Windows.If you try another way and succeed,please let us know how you did it!

Installing Python

We recommend installing Python through Anaconda.Anaconda is a library that includes Python and many useful packages for Python,as well as an environment manager called conda that makes package management simple.

Followthe installation instructionsfor Anaconda here.Download and install Anaconda 3.x (at time of writing,3.6).Then create a conda env for organizing packages used in Spinning Up:

conda create -n spinningup python=3.6

To use Python from the environment you just created,activate the environment with:

source activate spinningup

You Should Know

If you're new to python environments and package management,this stuff can quickly get confusing or overwhelming,and you'll probably hit some snags along the way.(Especially,you should expect problems like,"I just installed this thing,but it says it's not found when I try to use it!") You may want to read through some clean explanations about what package management is,why it's a good idea,and what commands you'll typically have to execute to correctly use it.

FreeCodeCamphas a good explanation worth reading.There's a shorter description onTowards Data Sciencewhich is also helpful and informative.Finally,if you're an extremely patient person,you may want to read the (dry,but very informative)documentation page from Conda.


As of November 2018,there appears to be a bug which prevents the Tensorflow pip package from working in Python 3.7.To track,seethis Github issue for Tensorflow.As a result,in order to use Spinning Up (which requires Tensorflow),you should use Python 3.6.

Installing OpenMPI


sudo apt-get update && sudo apt-get install libopenmpi-dev

Mac OS X

Installation of system packages on Mac requiresHomebrew.With Homebrew installed,run the follwing:

brew install openmpi

Installing Spinning Up

git clone
cd spinningup
pip install -e .

You Should Know

Spinning Up defaults to installing everything in Gymexceptthe MuJoCo environments.In case you run into any trouble with the Gym installation,check out theGymgithub page for help.If you want the MuJoCo environments,see the optional installation arguments below.

Check Your Install

To see if you've successfully installed Spinning Up,try running PPO in the LunarLander-v2 environment with

python -m ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999

This might run for around 10 minutes,and you can leave it going in the background while you continue reading through documentation.This won't train the agent to completion,but will run it for long enough that you can seesomelearning progress when the results come in.

After it finishes training,watch a video of the trained policy with

python -m test_policy data/installtest/installtest_s0

And plot the results with

python -m plot data/installtest/installtest_s0

Installing MuJoCo (Optional)

First,go to themujoco-pygithub page.Follow the installation instructions in the README,which describe how to install the MuJoCo physics engine and the mujoco-py package (which allows the use of MuJoCo from Python).

You Should Know

In order to use the MuJoCo simulator,you will need to get aMuJoCo license.Free 30-day licenses are available to anyone,and free 1-year licenses are available to full-time students.

Once you have installed MuJoCo,install the corresponding Gym environments with

pip install gym[mujoco,robotics]

And then check that things are working by running PPO in the Walker2d-v2 environment with

python -m ppo --hid "[32,32]" --env Walker2d-v2 --exp_name mujocotest