Section author: Robert Nikutta <nikutta@noao.edu>

1.8. Install Data Lab

You can install the Data Lab client interfaces and the command line tool easily on your computer.

There are several methods. All assume that you already have a working Python installation on your system (we recommend the Anaconda distribution, since it comes with all Python packages that most users with ever need, and is very easy to install).

1.8.1. Install using pip

The simplest way to install the Data Lab client interfaces and the command line tool is with pip:

pip install datalab-client

You should now be able to execute the datalab command from anywhere on your system:

datalab help

The installation will also enable you to import the various Data Lab client interfaces and helpers in your own Python programs. For instance, in a Python or Ipython session:

from dl import authClient as as, queryClient as qc, helpers
from getpass import getpass
token = ac.login(raw_input('Enter user name:',getpass('Enter password: ')) # obtain authentication token
query = 'SELECT ra,dec FROM smash_dr1.exposure LIMIT 100' # SQL query string
result = qc.query(token,query) # your query result as a CSV-formatted string
df = helpers.convert(result,'pandas') # result as a Pandas data frame

1.8.2. Clone directly from Data Lab’s github repository

If you have git installed on your system, you can simply clone the Data Lab client interfaces and the command line tool from the Data Lab github repository:

git clone https://github.com/noao-datalab/datalab-client

This will create a directory datalab-client/ in the current directory. You can then change to to it, and run the installation:

cd datalab-client/
python setup.py install

Then you should be able to use the datalab command line tool and the Python interfaces in the same manner as describen in the pip install section above.

You can also visit the github repository online.