We have decided to hold a study session on the subject of Python Machine Learning Programming (Impress). Since Python 3.6 has also been released, I will summarize how to build the environment again.
The environment construction performed here is as follows.
The following is assumed to have been installed.
$ VirtualBox --help
Oracle VM VirtualBox Manager 5.0.30
$ vagrant version
Installed Version: 1.9.1
Latest Version: 1.9.1
VirtualBox + Vagrant
Prepare a folder for Vagrant. This time, I will study machine learning, so prepare a folder called ~ / vagrant / ml-study
and prepare the environment.
$ mkdir ~/vagrant/ml-study
Addition of Vagrant Box
$ vagrant box add ubuntu/xenial64 https://atlas.hashicorp.com/ubuntu/boxes/xenial64/versions/20170104.0.0/providers/virtualbox.box
Start Vagrant
$ vagrant init ubuntu/xenial64
$ vagrant up
Vagrant settings (edit Vagrantfile)
Enable config.vm.provision
at the bottom and write:
...
config.vm.provision "shell", inline: <<-SHELL
apt-get update
sudo apt-get install -y build-essential libssl-dev libxml2-dev libxslt1-dev libbz2-dev zlib1g-dev python-setuptools python-dev libjpeg62-dev libreadline-gplv2-dev
sudo apt-get install -y libblas-dev liblas-dev liblapack-dev gfortran libfreetype6-dev
SHELL
...
Reflection of settings
$ vagrant provision
Since the necessary packages are described in Vagrantfile, it will be installed on the vagrant side.
Python 3.6
$ mkdir ~/tmp
$ sudo mkdir /opt/python36
$ sudo chown ubuntu /opt/python36
$ cd tmp
$ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
$ tar zxvf Python-3.6.0.tgz
$ cd Python-3.6.0/
$ ./configure --prefix=/opt/python36
$ make && make install
$ cd ~
$ /opt/python36/bin/python3 -m venv python
$ source python/bin/activate
$ pip install numpy scipy pandas scikit-learn matplotlib
$ pip install ipython[notebook]
$ pip install seaborn
$ pip install pyprind
$ cd ~/vagrant/ml-study
$ vagrant up
$ vagrant ssh
$ cd ~
$ source python/bin/activate
$ jupyter notebook
When stopped
$ vagrant halt
(Added on January 8, 2017)
When I try to access Jupyter notebook directly from the host machine with a browser, it is rejected due to IP restrictions. IP restrictions can be lifted by making the following settings.
$ source python/bin/activate
$ jupyter notebook --generate-config
~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip = '*'