jupyter
to run the notebooksHere are some distributed notebooks:
jupyter
You can find instructions for installing jupyter on their web site.
To run sql inside our notebooks, we also need ipython-sql
, we can install it with:
pip install --user --upgrade ipython-sql
Some of you have reported that you get the error:
ERROR:root:Cell magic `%%sql` not found
See below, on how to run...
jupyter
at LTHJupyter is installed on the Linux computers at LTH, but we need to do two things to make it work (you only need to do this once, then it should work the next time you log in):
We need to add /usr/local/anaconda3/bin
to our $PATH
:
export PATH=$PATH:/usr/local/anaconda3/bin
I recommend you put the line above in your .bashrc
- or .zshrc
- file
We need to run (same as above)
pip install --user --upgrade ipython-sql
After these two steps, we can follow the instructions for running the notebooks below.
After you have installed jupyter
, you can download and unpack the notebooks distributed on the course web site, start a browser, open a command line interpreter (shell), go to the directory with the notebook, and run
jupyter notebook
You have to chose what notebook to run, the notebooks are the files ending in .ipynb
.
For each cell you want to evaluate, activate the cell (by tab-ing your way or clicking), and press Shift-Enter. Each cell can only contain one SQL command (prefixed by %sql
or %%sql
), but you can easily insert new cells in the menu above (the +
-button creates a new cell below the active cell, and the Insert
-menu has commands for inserting above and below the current cell).
Some of you have reported that you get the error:
ERROR:root:Cell magic `%%sql` not found
It's probably because you haven't evaluated the
%load_ext sql
cell (it's normally the first cell). Also make sure that you import any relevant database by evaluating cells like:
%sql sqlite:///lab1.db
I'll talk a bit more about it during the lecture on Wednesday Jan 18.