Notes on Ubuntu (Linux) computing

Brief notes on installation, setup and other tasks in the Ubuntu world

pdftk on Ubunt 12.04

leave a comment »

pdftk is a wonderful (command line) tool for manipulating pdf documents in all kinds of ways. See the list of examples at this page to get an idea of what can be done.

To install the version in the repository type

sudo apt-get install pdftk

As an example, I often like to combine many pdf plots into a single document to make viewing easier. This can be done with the command

pdftk *.pdf cat output combinedplots.pdf

This takes all pdfs in the directory and creates a single file called combinedplots.pdf — the source pdfs are not changed, only the new, merged document is created.

Advertisements

Written by Chris S

January 1, 2013 at 7:24 pm

Upgrade nose in Ubuntu 12.04

leave a comment »

A project I am working on uses nose for unit testing. The default version of nose in the Ubuntu 12.04 repository is not the most current and I am experiencing some issues so I will upgrade.

First, remove old package

sudo apt-get remove python-nose

Download the current version (1.2.1)

tar -xzf nose-1.2.1.tar.gz
cd nose-1.2.1/

Following the notes here change line 71 of setup.py from

packages = ['nose', 'nose.ext', 'nose.plugins', 'nose.sphinx'],

to

packages = ['nose', 'nose.ext', 'nose.plugins', 'nose.sphinx', 'nose.tools'],

Finally, install in the usual way

sudo python setup.py install

Written by Chris S

December 28, 2012 at 10:47 pm

Installing pomp in R

leave a comment »

pomp (partially-observed Markov processes) is a package in R for simulating stochastic and deterministic mathematical models as well as to infer parameters using observed data — also see the r-forge page. I will provide (very) brief install instructions here and provide examples of use in later posts.

Install by going to the command line and starting R using sudo (I assume you are using Ubuntu here):

sudo R

Once in R, type:

install.packages('pomp', dep = TRUE)

The pomp package and other packages it requires will be downoaded, compiled, and installed. You can test that pomp is available by loading the package in an R session:

library(pomp)

Written by Chris S

December 22, 2012 at 7:02 pm

Upgrading IPython to the development version

with 2 comments

2014/05/13: It has been reported to me that recent attempts to use the install procedure detailed below have had issues. It is certain that IPython has progressed quite a bit since I wrote this post (almost two years ago). If you can’t use the version in the Ubuntu repository, I would suggest using pip and following the install instructions at the IPython website.

In a previous post I described installing IPython using the version in the repository. This installs version 0.12.1, an older release, resulting in compatibility issues with IPython notebooks saved in newer versions. As a result, I will remove the repository version and install the development version on github.

First, remove the repository version:

sudo apt-get remove ipython ipython-notebook

Note, I do not use the additional commands to remove all dependencies (mathjax, tornado, etc.) because these are still needed for the new install.

To install from github, cd to an appropriate directory and run:

git clone https://github.com/ipython/ipython.git
cd ipython
sudo python setup.py install

Now, test it out by launching a notebook:

ipython notebook --pylab inline

Thus far, everything seems to work and using the git repository allows for me to easily update versions if needed.

Written by Chris S

December 14, 2012 at 5:32 pm

Posted in Python, Ubuntu 12.04

Tagged with , , ,

Installing gitg in Ubunut 12.04

leave a comment »

I use git version control for many projects. Mostly I use the command line tools to do all of my work but I’d like to find a useful GUI for looking at branches, diffs, etc. My first test will be the version of gitg in the repository.

Install with

sudo apt-get install gitg

Seems like a useful tool for browsing repositories, visualizing branches, looking at diffs, staging and committing changes with messages.

Written by Chris S

December 12, 2012 at 6:24 pm

Installing R on Ubuntu 12.04

with 13 comments

I install R using the instructions at cran.r-project.org (direct link to instructions). At the website, click ‘Download R for Linux’ then ‘ubuntu’ to get the most up-to-date instructions. Following these instructions, my process was as follows:

Add the repository, using the CRAN server of your choice (I use UCLA here) and the appropriate Ubuntu version (I use precise for Ubuntu 12.04):

sudo add-apt-repository "deb http://cran.stat.ucla.edu/bin/linux/ubuntu precise/"

For security, get the key and add it to your keyring (NOTE: the CRAN website says that some people are having issues with this step — if the commands here do not work for you, check there for latest information):

gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

Next, update and install (the documentation says you might want to install r-base-dev as well, but I found this package is already included using the commands below):

sudo apt-get update
sudo apt-get install r-base

Installing packages

To install package not in the base set, use the following commands

sudo R

Now, inside R, install package packagename with

install.packages('packagename', dep = TRUE)

Note — the quotes around the packagename ARE needed.

Updating packages

Again, start R with sudo:

sudo R

Now, inside R, update packages with

update.packages(ask = FALSE)

rstudio

I do much of my coding in Geany irrespective of the language. However, the rstudio IDE/GUI is nice and available on all major platforms (Win,MAC,Linux) making it useful for teaching R.

  • Download the debian package from http://www.rstudio.org
  • I downloaded RStudio 0.97.237 – Debian 6+/Ubuntu 10.04+ (64-bit) — this is actually a file: rstudio-0.97.237-amd64.deb
  • If all dependencies are installed (output will complain if not), install rstudio-0.97.237-amd64.deb file using
    sudo dpkg -i rstudio-0.97.237-amd64.deb
    

    I got a complaint about libjpeg62 and installed is using:

    sudo apt-get install libjpeg62
    

    followed by the installation of the deb file, as shown above.

Written by Chris S

December 9, 2012 at 10:51 pm

Posted in R, Ubuntu 12.04

Tagged with , ,

Pandora with scrobbling to last.fm on Ubuntu 12.04

leave a comment »

I will try out Pithos to listen to Pandora radio and scobble tracks at last.fm — this tool is designed to do that in the Linux environment. Install using the PPA, as described at the website:

sudo add-apt-repository ppa:kevin-mehall/pithos-daily
sudo apt-get update
sudo apt-get install pithos

Installed and tested it out using accounts at pandora.com and last.fm — everything seems to work. There is nice integration into the Ubuntu music environment and data seems to be getting to last.fm — nice.

Written by Chris S

November 27, 2012 at 2:18 am