Skip to content

Vagrant Environment

Prageeth Jayathissa edited this page Aug 9, 2020 · 6 revisions

NOTE: This is no longer necessary as we have a python pipeline which will check the code for consistency

Testing of the Sofware is done within the Vagrant environment to maintain consistency between platforms www.vagrantup.com

Installing Vagrant

To Install Vagrant, follow the instructions on the website https://www.vagrantup.com/intro/getting-started/install.html

Installing Virtual Environment

We use the ubuntu/trusty64 virtual environment which can be downloaded from terminal by typing vagrant box add ubuntu/trusty64

Starting up Virtual Environment

From the command line type

vagrant up

It will take about 5minutes to set up the ubuntu virtual environment, install python + dependencies which are included in the requirements.txt file.

from here type vagrant ssh to enter the virtual machine. Then type cd ../../vagrant.

You will see the normal folder structure. Find the python script you would like to test and run it. If there are any errors, then check the dubugging section below.

Damn You Pandas!!

For some reason, pip3 install pandas does not work...... It is therefore excluded from the requirements file, and installed seperately in bootstrap.sh as sudo apt-get install python3-pandas

Debugging Errors

There are some reasons why the tests may pass on your local machine, but not the virtual machine

  • Plots. It is difficult to plot in a virtual environment. You will have to ssh -X to send the plot to the main computer
  • Check requirements.txt to ensure that your modules that you are importing are present
  • run vagrant provision to reinstall any new dependencies
  • The virtual machine runs python3, so ensure that your python modules are py3 compatible. print statements are usually a killer