In this post i will show how we can have a machine learning environment with python and scikit-learn in Vagrant.
Python is a great language however use it in windows is hard because most of libraries might now work property so something is easier just provision a environment with Vagrant and them do it in Linux - thats what we goona do. This is pretty straight forward you just need to have vagrant installed and configured before we start.
Vagrant + Python + Scikit-Learn
So you just need have this Vagrantfile
As you can see we are installing pip for python 2 and python 3. Once you download my Vagrant file you just need do a $ vagrant up
This could take some time because there are lots of libraries and dependencies. After the provisioning you can enter on the box via ssh doing $ vagrant ssh
IF you want to test your scikit-learn you can create this python script inside your vagrant linux.
Likewise RStudio scikit-Learn comes with some datasets like iris. You can run this code now. You might be interested in plotting them you can copy the commands to install sci-kit and install into a virtual box instance of Ubuntu in order to have graphical interface. That`s it, Have fun :-) Cheers, Diego Pacheco
Python is a great language however use it in windows is hard because most of libraries might now work property so something is easier just provision a environment with Vagrant and them do it in Linux - thats what we goona do. This is pretty straight forward you just need to have vagrant installed and configured before we start.
Vagrant + Python + Scikit-Learn
So you just need have this Vagrantfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.network "private_network", ip: "55.55.55.101" | |
config.vm.synced_folder ".", "/home/vagrant/shared/" | |
config.vm.provision "shell", inline: <<-SHELL | |
sudo apt-get update | |
sudo apt-get install -y wget | |
sudo apt-get install -y curl | |
sudo apt-get install -y vim | |
sudo apt-get install -y git | |
sudo apt-get install -y build-essential | |
# | |
# Installs Python pip for python 2 and 3 | |
# | |
sudo wget https://bootstrap.pypa.io/get-pip.py | |
sudo python2 get-pip.py | |
sudo python3 get-pip.py | |
# | |
# Install Python Machine Learning: scikit-learn | |
# | |
sudo apt-get install -y python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose | |
sudo apt-get install -y build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base | |
sudo pip3 install -U scikit-learn | |
SHELL | |
end |
This could take some time because there are lots of libraries and dependencies. After the provisioning you can enter on the box via ssh doing $ vagrant ssh
IF you want to test your scikit-learn you can create this python script inside your vagrant linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import datasets | |
iris = datasets.load_iris() | |
digits = datasets.load_digits() | |
print(digits.data) |
comment 0 comments