Posts Tagged ‘github’
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):
git is a tool for version control on programming projects. The install is easy:
sudo apt-get install git
Setup github access
Assuming you already have an account, the following gets github ssh access up and running, following the process described here. The following commands set parameters and generate a key for upload to the github website:
git config --global color.ui true git config --global user.name "Your Name" git config --global user.email "firstname.lastname@example.org" ssh-keygen -t rsa -C "email@example.com"
Copy the key to the clipboard (setup xclip if in needed — see here)
cat ~/.ssh/id_rsa.pub | clipboard
Your key is now in your clipboard, go to the github website and paste the new key in the appropriate area:
Finally, test to make sure that it works:
ssh -T firstname.lastname@example.org