Jupyter is a web application that lets you create interactive/sharable code on multiple languages including Python [http://jupyter.org/]


OPTION 1

Jupyter is already installed in the TP room computers. You can find it in:

Menu>Dévelopment>Ipython Notebook (Anaconda)

The default python version is 2.x

We need to install the ipython-sql extension (which provides the %sql magic).

  • In a terminal run the following command:
    pip install --user --upgrade ipython-sql
    
  • Now you can start Jupyter, it may take some time until it loads the content of the local folder.

    If Jupyter does not loads the content of the folder:

    1. Click on the home logo inside Jupyter (the blue house icon) and wait
    2. If nothing loads after 1 min, close Jupyter and the related terminal window (Ctrl+c twice) and try again
  • Once the content of the local folder is loaded, you can navigate to the folder where the notebook file (.ipynb) is located.
    • Double click on the notebook file to open it.
    • The notebook should work now

OPTION 2

Create a virtual environment for the TP which includes:

  • Python (3.x recommended)
  • Jupyter
  • iPython-sql

You need to do the following:

  1. From the course website, get the script virtualenv-script.sh and save it into the path where the virtual environment will be created (~90MB of free space required)
  2. In a terminal, go to the path where you placed virtualenv-script.sh:
cd path
  1. Change permissions to execute the script
chmod +x virtualenv-script.sh
  1. Run the script
./virtualenv-script.sh
  1. If no errors are reported then we can use the virtual environment:

    5.1 Activate the virtual environment

    source DBTPenv/bin/activate
    

    5.2 Lunch jupyter

    jupyter notebook
    

    5.3 Deactivate when done

    deactivate
    

OPTION 3

If you want to work in your personal computer you will need:

  • Python (3.x recommended)
  • Jupyter
  • ipython-sql extension

Anaconda is the easiest way to get a working python environment (Linux, MacOS, and Windows). Anaconda includes a collection of popular packages on different fields (including Jupyter).
[https://www.continuum.io/downloads]

Miniconda is a minimalistic version of Anaconda which contains only conda (package administrator) and Python. Extra packages have to be installed manually (Jupyter and ipython-sql). This option is recommended if HD space is a constraint.
[https://conda.io/miniconda.html]

To install the ipython-sql extension:

  1. Run the following command in the command prompt:
pip install ipython-sql

Note: If you are using Windows, pip requires a compiler sometimes [https://wiki.python.org/moin/WindowsCompilers].

If you can not use pip, this is a workaround:

  1. Download the project from https://github.com/catherinedevlin/ipython-sql

    In the top right section of the page you will find a green button (“Clone or Download”), click it to get a link for the zip file containing the project.

  2. Extract the content of the zip file from the previous step to a path in your computer.
  3. In the command promt, go to the path where you extracted the files and run the following command:
python setup.py install