Skip to content

Instantly share code, notes, and snippets.

@flameoftheforest
Last active December 28, 2017 11:32
Show Gist options
  • Save flameoftheforest/a171fe72e046666ad12fa96e879a9b80 to your computer and use it in GitHub Desktop.
Save flameoftheforest/a171fe72e046666ad12fa96e879a9b80 to your computer and use it in GitHub Desktop.
Vagrantfile for Tensorflow + Jupyter (numpy, scipy, sklearn, tensorboard)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# NOTE: Vagrant-VBGuest plugin needs to be installed.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant development environment requires a box.
config.vm.box = "ubuntu/xenial64"
config.vm.synced_folder "./", "/home/ubuntu/shared/"
# Forward port 8888 for Jupyter notebook
config.vm.network "forwarded_port", guest: 8888, host: 8888
# Forward port 6006 for TensorBoard
config.vm.network "forwarded_port", guest: 6006, host: 6006
config.vm.provider "virtualbox" do |vb|
vb.name = "TensorflowNumpy"
# Configure resources dedicated to the VM.
vb.memory = 6144
vb.cpus = 2
end
# Download and install everything on first run.
config.vm.provision :shell, inline: <<-SHELL
echo UPDATE
echo ++++++++++++++++++
apt-get install software-properties-common
add-apt-repository ppa:george-edison55/cmake-3.x
add-apt-repository ppa:fkrull/deadsnakes
apt-get update
echo UPGRADE
apt-get upgrade -y
echo INSTALL PYTHON3 STUFF
apt-get install -y cmake git build-essential python3.5 python3-dev python3-pip python-pip python3-matplotlib python-minimal libblas-dev liblapack-dev libatlas-base-dev gfortran python-numpy zlib1g-dev libjpeg-dev libboost-all-dev gcc libsdl2-dev wget unzip swig
# Make sure pip is update.
pip3 install --upgrade pip
pip install --upgrade pip
# echo INSTALL TENSORFLOW
# echo ++++++++++++++++++
# This here follows the tensorflow installation through pip process.
# These here are the dependencies required by tensorflow.
easy_install -U pip
pip3 install absl-py
pip3 install numpy
pip3 install six
pip3 install protobuf
pip3 install tensorflow-tensorboard
# This here sets up tensorflow.
# Note: https://github.com/tensorflow/tensorflow/issues/6548
# states --ignore-installed should be used to get tensorflow
# to install properly.
pip3 install --ignore-installed tensorflow
echo INSTALL JUPYTER NUMPY SCIPY SKLEARN
echo +++++++++++++++++++++++++++++++++++
pip3 install jupyter
pip3 install scipy
pip3 install sklearn
pip3 install pandas
echo INSTALL GYM
cd /vagrant
if [ -d "/vagrant/gym" ]; then
cd gym
git reset --hard
git pull
else
git clone https://github.com/openai/gym
cd gym
fi
pip install -e .
pip install .[all]
echo "[vagrant provisioning] Setup complete"
SHELL
config.vm.provision "shell", run: "always", inline: <<-SHELL
echo there\'s a python and a python3, when running jupyter, may need to make sure it\'s running
echo python3 and restart kernel on that.
echo use: jupyter notebook --notebook-dir=~/notebook --no-browser --ip=0.0.0.0
echo "[vagrant provisioning] Notebook ready: go open http://localhost:8888/ in a browser"
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment