Installation of software

INF5620 presents a lot of computer codes for solving partial differential equations. These codes are mostly written in Python, but apply sometimes computing intensive snippets in Cython, C, C++, or Fortran. The necessary software environment consists of

  • Python and a range of mathematical packages
  • LaTeX, imaging tools, version control systems
  • C, C++, and Fortran compilers

We have described some technologies for getting access to Python, but for this course we strongly recommend to run a virtual Ubuntu machine in VMWare Fusion, VirtualBox, or the slightly different Vagrant technology, because all the necessary software is trivial to install on Ubuntu. We have ready-made machines for the course.

Notat

A very good alternative is to install Ubuntu in a dual boot fashion, e.g., via Wubi (note that there have been problems with Windows 8 and Wubi). This is the best solution if you want Ubuntu to utilize the maximum power the machine can provide. It is a matter of personal preference whether you want to restart the machine to switch from Windows to Ubuntu or if you prefer to have both running at the same time.

More specifically, the following packages are needed:

All these packages and much more can be installed on Ubuntu by this script. As mentioned, we have prebuilt Ubuntu machines where this script has already been run.

Don't install all this software directly on Mac or Windows

The listed software is complex and non-trivial to install on Mac OS X or Windows 7/8. It requires much experience to get all pieces to work together, so unless you have extensive experience with building and installing complex mathematical packages on Windows or Mac, stay away from it and rely on Ubuntu.

VMWare Fusion virtual machine

A virtual machine allows you to run another complete computer system in a separate window. For Mac users, I recommend VMWare Fusion over VirtualBox for running a Linux (or Windows) virtual machine. (VMWare Fusion's hardware integration seems superior to that of VirtualBox.) VMWare Fusion is commercial software, but there is a free trial version you can start with. Alternatively, you can use the simpler VMWare Player, which is free for personal use.

Installing Ubuntu

The following recipe will install a Ubuntu virtual machine under VMWare Fusion.

  1. Go to http://goo.gl/nSeBCg and download a full-blown Ubuntu box for scientific computing: ubuntu-14.04-amd64-vmware.ova (6.7 Gb!).

  2. Launch VMWare Fusion.

  3. Click on File - Import, then Choose file, and browse to the to the ubuntu-14.04-amd64-vmware.ova file you downloaded.

  4. Type your chosen name of the virtual machine in the Save As text box and rely on the default location. Your entire virtual machine is stored in this file, and backing up the machine means backing up the file.

  5. Click Import.

  6. Press Command+E (or go to Virtual Machine - Settings...). Specify the following:

    • Processors and Memory: Set a minimum of 2 Gb memory, but not more than half of your computer's total memory. The virtual machine can use all processors.
    • Hard Disk: Choose how much disk space you want to use inside the virtual machine (20 Gb is considered a minimum).
  • Start up the virtual Ubuntu machine. The username and password for this machine are fenics.

  • You may need to define a higher resolution of the display in the Ubuntu machine. Find the System settings icon on the left, go to Display, choose some display (you can try several, click Keep this configuration when you are satisfied).

  • You can have multiple keyboards on Ubuntu. Launch System settings, go to Keyboard, click the Text entry hyperlink, add keyboard(s) (Input sources to use), and choose a shortcut, say Ctrl+space or Ctrl+backslash, in the Switch to next source using field. Then you can use the shortcut to quickly switch keyboard.

    1. A terminal window is key for programmers. Click on the Ubuntu icon on the top of the left pane, search for gnome-terminal, right-click its new icon in the left pane and choose Lock to Launcher such that you always have the terminal easily accessible when you log in. The gnome-terminal can have multiple tabs (Ctrl+shift+t to make a new tab).

    Pre-i3/5/7 Intel processors and 32 vs. 64 bit

    If your computer has a pre-i3/5/7 Intel processor and the processor does not have VT-x enabled, you cannot use the pre-packaged 64-bit virtual machines. Instead, you have to download a plain 32-bit image (from http://www.ubuntu.com/download/desktop and install the necessary software (see next section). To check if your computer has VT-x (hardware virtualization) enabled, you can use this tool: URL: https://www.grc.com/securable.htm.

    Installing software on a minimalistic Ubuntu machine

    If you have a minimalistic Ubuntu machine downloaded from the Ubuntu site, you need to install additional software for scientific computing with Python:

    Terminal> sudo apt-get install python-setuptools python-pip mercurial
    Terminal> sudo pip install numpy sympy scipy nose pytest
    Terminal> sudo apt-get install python-matplotlib spyder
    Terminal> sudo pip install ipython --upgrade
    Terminal> sudo pip install tornado --upgrade
    Terminal> sudo pip install pyzmq --upgrade
    Terminal> sudo pip install -e \
              git+https://github.com/hplgit/scitools.git#egg=scitools
    

    File sharing

    The Ubuntu machine can see the files on your host system if you download VMWare Tools. Go to the Virtual Machine pull-down menu in VMWare Fusion and choose Install VMWare Tools. A tarfile is downloaded. Click on it and it will open a folder vmware-tools-distrib, normally in your home folder. Move to the new folder and run sudo perl vmware-install.pl. You can go with the default answers to all the questions.

    On a Mac, you must open Virtual Machine - Settings... and choose Sharing to bring up a dialog where you can add the folders you want to be visible in Ubuntu. Just choose your home folder. Then turn on the file sharing button (or turn off and on again). Go to Ubuntu and check if you can see all your host system's files in /mnt/hgfs/.

    If you later detect that /mnt/hgfs/ folder has become empty, VMWare Tools must be reinstalled by first turning shared folders off, and then running:

    Terminal> sudo /usr/bin/vmware-config-tools.pl
    

    Occasionally it is necessary to do a full reinstall by sudo perl vmware-install.pl as above.

    Backup of a VMWare virtual machine on a Mac

    The entire Ubuntu machine is a folder on the host computer, typically with a name like Documents/Virtual Machines/Ubuntu 64-bit. Backing up the Ubuntu machine means backing up this folder. However, if you use tools like Time Machine and work in Ubuntu during backup, the copy of the state of the Ubuntu machine is likely to be corrupt. You are therefore strongly recommended to shut down the virtual machine prior to running Time Machine or simply copying the folder with the virtual machine to some backup disk.

    If something happens to your virtual machine, it is usually a straightforward task to make a new machine and import data and software automatically from the previous machine.

    VirtualBox virtual machine

    VirtualBox is free software that allows you to run a virtual machine with, e.g., the Ubuntu operating system. Download and install VirtualBox. Choose the version according to the operating system on the host. On Mac OS X, choose VirtualBox x.y.z for OS X hosts, where x.y.z is the version number of VirtualBox. Double click the downloaded .dmg file to install Vagrant. Those who work on a Windows machine will select VirtualBox x.y.z for Windows hosts, which downloads an .exe file to be double clicked to perform the installation.

    The next step is to download a full-blown, pre-built Ubuntu machine with a lot of tools for doing scientific computing. Go to http://goo.gl/nSeBCg and download the file ubuntu-14.04-amd64.ova (6.4 Gb!). We refer to the VirtualBox manual for how to import such a machine. The username and password for the virtual machine are fenics.

    Pre-i3/5/7 Intel processors and 32 vs. 64 bit

    If your computer has a pre-i3/5/7 Intel processor and the processor does not have VT-x enabled, you cannot use the pre-packaged 64-bit virtual machines. Instead, you have to download a plain 32-bit Ubuntu image and install the necessary software (see the section Installing software on a minimalistic Ubuntu machine). To check if your computer has VT-x (hardware virtualization) enabled, you can use this tool: https://www.grc.com/securable.htm.

    Vagrant virtual machine

    A vagrant machine is different from a standard virtual machine in that it is run in a terminal window on a Mac or Windows computer. You will write programs in Mac/Windows, but run them inside a Vagrant Ubuntu machine that can work with your files and folders on Mac/Windows. This is a bit simpler technology than a full VMWare Fusion virtual machine, as described above, and allows you to work in your original operating system. There is need to install VirtualBox and Vagrant, and on Windows also Cygwin. Then you can download a Vagrant machine with Ubuntu and either fill it with software as explained above, or you can download a ready-made machine. A smaller special machine has been made for INF1100 (this machine runs Ubuntu 13.04). We have a newer and richer machine running Ubuntu 14.04. This machine has most of the software you need for bachelor and master studies in natural science at the University of Oslo. The username and password are fenics.

    Pre-i3/5/7 Intel processors and 32 vs. 64 bit

    If your computer has a pre-i3/5/7 Intel processor and the processor does not have VT-x enabled, you cannot use the pre-packaged 64-bit virtual machines referred to above. Instead, you have to download a plain 32-bit Ubuntu image and install the necessary software (see the section Installing software on a minimalistic Ubuntu machine). To check if your computer has VT-x (hardware virtualization) enabled, you can use this tool: https://www.grc.com/securable.htm.

    Av Hans Petter Langtangen
    Publisert 6. juli 2015 13:30