Archive for November 2013
The vim-template plugin allows for the use of templates for different file types: *.html, *.py and so on. Following the installation instructions (see above link), we use pathogen to install the plugin:
cd ~/.vim/bundle git clone git://github.com/aperezdc/vim-template.git
Use of plugin
Now, you can make use of the templates when starting vim. For example, a python template is loaded by recognition of the *.py filename:
Or, if you have new buffer, type the following for the template to be loaded inside vim:
The available templates can be seen here. Using the pathogen installation described above, these templates are located (on your machine) at
If you want to customize certain fields, like email and username, you can add the following to your .vimrc file:
" Customize the settings for vim-template plugin let g:email = "firstname.lastname@example.org" let g:user = "Desired Name" let g:license = "Desired License"
If you want to customize the templates, there is a search order for templates (see here) allowing you to write your own template-files and store them in the local directory.
In this post I will document my installation of (the bleeding edge, development version) of scikit-learn. You might not want to do this — there are stable releases with installation instructions available at the package website. In fact, there are Ubuntu/Debian-specific installation instructions. I would suggest using the Ubuntu package unless you know that you need that latest code. The reason for this is that dependencies will be taken care of by the package manager; otherwise you will have to figure out the dependencies yourself.
Now on to the specifics, assuming you want to install this version. First, change to a directory where you want the git repository to live, and clone the github repository:
git clone git://github.com/scikit-learn/scikit-learn.git
Following the instructions, change directory to the repository and use the included Makefile
cd scikit-learn make
This will build the package locally and run a bunch of tests (~2600 using nosetests) to make sure that everything works on you computer.
The commands in the Makefile do not install the package on the system. Instead, the scikit-learn website suggests including the path of the (built) package in your
PYTHONPATH. I will do this in a slightly unconventional way that does not require admin privileges, allows the path to be included for a specific version of python, for a single user, and employs basic
bash commands (this follows ideas from here — look for subsection on The bash way).
First, find out where your version of python has the user site-packages directory.
python -m site --user-site
If you have multiple versions of python installed and just want to affect python 2.6 you would use
python2.6 -m site --user-site instead. Next, the directory provided by the above command may not exist. To make sure that it does, make the needed directory:
mkdir -p $(python -m site --user-site)
python2.6 in the above if you need to be more specific. Finally, we make a mypath.pth file in this directory that allows python to find scikit-learn:
echo "/home/username/gitLocal/scikit-learn" >> $(python -m site --user-site)/mypath.pth
This assumes that you cloned the scikit-learn repository in
~/gitLocal/. If you did not, change the above to reflect the location for you computer. Again, change the version of python employed, it needed.
Everything should be setup now. To test, cd to you home directory (make sure you are not in the scikit-learn directory) and start python:
cd ~ python
Now, import scikit-learn (hopefully without error):