We shall work with a specific example: creating a computing environment for the participants in a course on computational X, where X is any science or engineering subject such as chemistry, physics, quantum mechanics, fluid dynamics, oceanography, and so forth. The challenge with courses featuring heavy computations is two-fold:
Another advantage is that all users of a Vagrant machine have exactly the same computing environment (unless they modify the machine). The teacher can then easily debug a user problem inside the teacher's own Vagrant machine. And anything that the teacher demonstrates on her computer works out of the box on the participants' computers.
Different types of Vagrant machines can be made for different types of courses or purposes. For example, a research project can set up a software environment for its project members, as a Vagrant machine, to ensure that the environment is conserved for the future, which is a key principle for replicable science. Users may have many Vagrant machines on their computers and switch between these computing environments.
The Vagrant machine needs to have an operating system. Here we choose Ubuntu of two main reasons:
To be specific, the sample computing environment to be illustrated here consists of a Python-based ecosystem for scientific computing. Examples on basic software includes
emacs
, vim
, gedit
gcc
, g++
, gfortran
numpy
, scipy
, sympy
, matplotlib
,
ScientificPython
sudo apt-get install packagename
command, but the Python packages
are often more conveniently installed in their latest version by a pip
install packagename
command. A few Python packages must be installed
directly from the source code, via downloading followed by
the sudo python setup.py install
command, if they do not exist in Debian, or if they are not supported
by pip install
, or if one needs to download the latest development
version. The example will in detail illustrate the various cases.
Much more sophisticated packages than those listed above,
for instance PETSc
and FEniCS, may be very challenging to
build from scratch, but as long as Debian versions are offered
(which is the case with PETSc and FEniCS), installation on a Debian-based
system like Ubuntu is still just a trivial apt-get install
command.
In the Vagrant machine, we create two directories:
~/bin
for executable programs and scripts~/srclib
for Python packages installed from source codersync
for copying files between machines, or
between machines and external disks or memory sticks.