Section author: Robert Nikutta <robert.nikutta@noirlab.edu>

Version: 20220215

1.8.1. 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.1. Install using pip

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

pip install --ignore-installed --no-cache-dir astro-datalab

The flags --ignore-installed and --no-cache-dir should ensure that the lastest version is pulled freshly from the internet.

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:

# this is for Python 3
> from dl import authClient as ac, queryClient as qc
> from dl.helpers.utils import convert
> from getpass import getpass

> ac.login(input("Enter user name: (+ENTER) "),getpass("Enter password: (+ENTER) ")) # credentials to log into datalab
> query = 'SELECT ra,dec FROM smash_dr1.exposure LIMIT 100' # SQL query string
> result = qc.query(sql=query) # your query result as a CSV-formatted string
> df = convert(result) # result as a Pandas data frame

1.8.1.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/astro-datalab/datalab.git

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

cd datalab
python setup.py install

If you want it installed in your private Python repository (because you maintain multiple Python instances on your machine) then do:

python setup.py install --user

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

Finally, if you intend to mount the virtual storage as a local filesystem, you will need to touch a file in your home directory:

touch ~/.netrc

You can also visit the github repository online.