Time for action - installing additional packages
1. Before installing a new package, you should check which packages exist already and what their version numbers are. Start Octave, if you have not done so. Type the following:
octave:1> pkg list
2. You should now see a table with package names, version numbers, and installation directories. For example:
Package Name | Version | Installation directory --------------------+-----------+------------------------------------ combinatorics | 1.0.6 | /octave/packages/combinatorics-1.0.6
3. If you have chosen to install all packages in your Windows installation, the list is long. Scroll down and see if the msh package is installed already, and if so, what the version number is. Again, you can press the Q key to return to the prompt.
4. Now go to the Octave-Forge web page, find the msh package, and click on Details (to the right of the package name). You will now see a window with the package description, as shown in the following figure. Is the package version number higher than the one already installed? (If not, sit back, relax, and read the following just for the fun of it.) The package description also shows that the msh package dependents on the spline package and Octave version higher than 3.0.0. Naturally, you need Octave. However, the spline package may not be installed on your system. Did you see the spline package when you typed
pkg list
previously? If not, we will need to install this before installing msh. Go back to the main package list and download the msh and the spline packages to your Octave home directory. (By the way, does the spline package have any dependencies?) The downloaded files will be archived and compressed and have extensions.tar.gz
. To install the packages, make sure you are in your Octave home directory and type the following:
octave:2> pkg install splines-version-number.tar.gz
(If you need it.)
octave:3> pkg install msh-version-number.tar.gz
5. Make sure that you have downloaded the package files into the Octave home directory.
6. To check your new package list, type the following:
octave:4> pkg list
Package Name | Version | Installation directory ---------------------+------------+----------------------------- combinatorics | 1.0.6 | /octave/packages/combinatorics-1.0.6 msh | 1.0.1 | /home/jesper/octave/msh-1.0.1 splines * | 1.0.7 | /home/jesper/octave/splines-1.0.7
7. You can get a description of the
msh
package by typing the following:
octave5:> pkg describe msh --- Package name: msh Short description: Create and manage triangular and tetrahedral meshes for Finite Element or Finite Volume PDE solvers. Use a mesh data structure compatible with PDEtool. Rely on gmsh for unstructured mesh generation. Status: Not loaded
8. From the status, you can see that the package has not been loaded, which means we cannot use the functionality that comes with the package. To load it, simply type the following:
octave:6> pkg load msh
9. You should check that it actually has been loaded using
pkg describe msh
. Naturally, you can also unload the msh package by using the following command:
octave:7> pkg unload msh
Note
If you are using a multi-user system, consult your system administrator before you install your own local packages.
What just happened?
The important points have already been explained in detail. Note that you need to install splines before msh because of the dependencies.
You may find it a bit strange that you must first load the package into Octave in order to use it. The package can load automatically if you install it with the auto
option. For example, command 3 can be replaced with the following:
octave:3> pkg install auto msh-version-number.tar.gz
Some packages will automatically load even though you do not explicitly instruct it to do so when you install it. You can force packages not to load using noauto
.
octave:3> pkg install noauto msh-version-number.tar.gz
Uninstalling a package
Unistalling a package is just as easy:
octave:8> pkg uninstall msh
Note that you will get an error message if you try to uninstall splines before msh because msh depends on splines.