Skip to content

Instantly share code, notes, and snippets.

@zafarali
Last active April 14, 2018 01:36
Show Gist options
  • Save zafarali/242ac90ba8a91fc9d1652cc733ef0bc3 to your computer and use it in GitHub Desktop.
Save zafarali/242ac90ba8a91fc9d1652cc733ef0bc3 to your computer and use it in GitHub Desktop.
Install Roboschool on ComputeCanda Clusters. See comments for how to use
# a special thanks to the ComputeCanada support team for making available these modules on the cluster!
# using this script is pretty easy, just `wget` this into a server and then `bash RoboschoolCluster.sh`
module load python/3.5.2
module load qt
module load gcc/6.4.0
module load boost/1.65.1
# this command should not fail
pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.5 tinyxml
#source $RVI_ENV
INSTALLDIR="$(pwd)/roboschool_installation"
echo "installing roboschool at $INSTALLDIR"
mkdir $INSTALLDIR
cd $INSTALLDIR
echo "Now cloning roboschool from github."
git clone https://github.com/openai/roboschool
ROBOSCHOOL_PATH="${INSTALLDIR}/roboschool"
echo "ROBOSCHOOL_PATH was set to $ROBOSCHOOL_PATH"
cd "$ROBOSCHOOL_PATH"
git clone https://github.com/olegklimov/bullet3 -b roboschool_self_collision
# patch makefile
cd roboschool/cpp-household
sed -i s'!-I/usr/include!!' Makefile
sed -i s'!moc -qt=5!moc!' Makefile
sed -i s'!LINK=gcc!LINK=g++!' Makefile
sed -i s'!POSTFIX = -py!POSTFIX = !' Makefile
cd ../..
mkdir -p bullet3/build
cd bullet3/build
echo "making bullet3"
CC=gcc CXX=g++ cmake -DBUILD_SHARED_LIBS=ON -DUSE_DOUBLE_PRECISION=1 -DCMAKE_INSTALL_PREFIX:PATH=$ROBOSCHOOL_PATH/roboschool/cpp-household/bullet_local_install -DBUILD_CPU_DEMOS=OFF -DBUILD_BULLET2_DEMOS=OFF -DBUILD_EXTRAS=OFF -DBUILD_UNIT_TESTS=OFF -DBUILD_CLSOCKET=OFF -DBUILD_ENET=OFF -DBUILD_OPENGL3_DEMOS=OFF ..
make -j4
make install
cd $INSTALLDIR/
echo "installing roboschool"
python -m venv roboschool_venv
source roboschool_venv/bin/activate
pip install -e roboschool/
pip install gym
echo "installation complete. To test you can try running: python roboschool/agent_zoo/demo_race2.py"
@zafarali
Copy link
Author

zafarali commented Apr 13, 2018

How to use:

mkdir openai or something where you have an empty directory and cd into it. Use wget to obtain this gist into that folder.

Then you can just to bash RoboschoolCluster.sh and it will install roboschool into a new virtual environment roboschool_venv that is found in your installation directory. I tried it and it works (I can use import roboschool with no problems)

If you want to install it into your current environment I think if you change the part in the install script where you create a new venv to loading your current venv it, in theory, should work?

I will update this file with some plots that I make.

Testing it

import roboschool
import gym
import numpy as np
env = gym.make('RoboschoolHopper-v1')
env.reset() # you should see anumpy array here.
env.step(np.array([0.3, -0.3, 0.3])) # works!

Modules needed

module load python/3.5.2
module load qt
module load gcc/6.4.0
module load boost/1.65.1

Common issues:

Boost failed to work at this line:

"/project/6002510/zafarali/openai/roboschool_installation/roboschool/bullet3/src/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanCL.h" "/project/6002510/zafarali/openai/roboschool_installation/roboschool/roboschool/cpp-household/bullet_local_install/include/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanCL.h"

You're probably having a disk quota issue (see if you can manually copy it.) For possible solutions see here: https://docs.computecanada.ca/wiki/Frequently_Asked_Questions#Disk_quota_exceeded_error_on_.2Fproject_filesystems

Thank you

A big thank you to the ComputeCanada team for making this easier to install. I'm sure we are really going to enjoy testing our algorithms on open source domains :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment