In order to install TensorFlow, we need a PC, perhaps better with Ubuntu on it. So, let me start with installing Ubuntu 18.04. The grand first step is to prepare an USB stick and format it with Disk Utility. Oh, I should have said I'm assuming you are using OSX (why not). Run Disk Utility, change the format to Mac OS Extended (Journaled), and set the partition scheme to GUID Partition Table. Then, download the ISO from here, and bake the USB with Etcher. Then, insert the USB to the PC, set boot order so that it sees the USB first, disable fast boot and secure boot, and install with the default option. Until Ubuntu 16.04, I used to partition disks by myself, but I decided to trust the default partition setting from 18.04. There still remains some problem about the infinite login loop related to the graphic card problem, but this is a well-known problem, so you can find tons of solutions for this. Install the graphic driver to have a proper looking screen, then, you are half way done.
Now, you will probably wonder why TensorFlow, not PyTorch, and it actually is a reasonable doubt. As you might have anticipated, I'm too lazy to learn new stuffs. Anyway, I'll use TensorFlow 1.14 for the exact same reason. Let's assume that we have one or more GPU(s), you might need CUDA as well. The bottom line is, we will install Python 3.6.8, NVIDIA-DRIVER 440, CUDA 10.0, cuDNN v7.6.5 (Nov 5th, 2019) for CUDA 10.0, Tensorflow 1.14. One excuse of using outdated 1.14 is that the stable-baselines (https://github.com/hill-a/stable-baselines) only supports up to TensorFlow 1.14. I heard that OpenAI is now using PyTorch. But, I'll use spinningup which also supports TensorFlow 1.14.
^ TF.1.15 seems to be fine as well, so, it is upto you. I've also made a github repo that contains some jupyter notebooks how to use TF.
Basic apt-gets
sudo apt-get update
sudo apt install build-essential
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install g++ freeglut3-dev libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
sudo apt-get install libxml2
sudo sh cuda_10.2.89_440.33.01_linux.run
Install the NVIDIA driver 440 ONLY.
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux
chmod +x cuda_10.0.130_410.48_linux & sudo ./cuda_10.0.130_410.48_linux
Install the CUDA 10.0 ONLY.
Download, extract, copy cuDNN v7.6.5
Setup .bashrc
echo export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}} >> ~/.bashrc
cho export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} >> ~/.bashrc
Python install with PyEnv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl zip git
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
pyenv install 3.6.8
pyenv rehash
pyenv global 3.6.8
pip install tensorflow-gpu==1.14 (or 1.15)
git clone https://github.com/sjchoi86/advanced-tensorflow.git (yep, it is mine. Stars are appreciated.)
Run any of them with
watch -n 1 nvidia-smi
Install spinningup
sudo apt-get update && sudo apt-get install libopenmpi-dev
git clone https://github.com/openai/spinningup.git
cd spinningup
pip install -e .
To check the install,
python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999
python -m spinup.run test_policy data/installtest/installtest_s0
python -m spinup.run plot data/installtest/installtest_s0
I guess the OpenAI env is being installed during installing spiningup
I checked the version and it was 0.15.7, which was release in Feb.14, 2020.
sudo apt-get install ubuntu-restricted-extras
+ hell more small things.
There are a lot of missing steps, but I'm pretty sure it will be a good exercise (I hate when the textbooks say this).