diff --git a/module2/ressources/jupyter.html b/module2/ressources/jupyter.html index e2b5200e14d62711563728fd717cef083306ee20..22def4f4058fd9939d130d4c3cb072a8052e7cd2 100644 --- a/module2/ressources/jupyter.html +++ b/module2/ressources/jupyter.html @@ -4,26 +4,27 @@

Table of Contents

-
-

1. Jupyter tips and tricks

-
+
+

1. Jupyter tips and tricks

+

The following webpage lists several Jupyter tricks (in particular, it illustrates many IPython magic commands) that should improve your @@ -43,9 +44,57 @@ the tricks may have been integrated in the default behavior of Jupyter now).

-
-

Running R and Python in the same notebook

-
+
+

Creating or importing a notebook

+
+

+Using the Jupyter environment we deployed for this MOOC will allow to +easily access any file from your default GitLab project. There are +situations however where you may want to play with other notebooks. +

+
+
Adding a brand new notebook in a given directory
Simply follow +the following steps: +
    +
  1. From the menu: File -> Open. You're now in the Jupyter file manager.
  2. +
  3. Navigate to the directory where you want your notebook to be created.
  4. +
  5. Then from the top right button: New -> Notebook: Python 3.
  6. +
  7. +Give your notebook a name from the menu: File -> Rename. +

    + +

    +N.B.: If you create a file by doing File -> New Notebook -> + Python 3, the new notebook will be created in the current +directory. Moving it afterward is possible but a bit cumbersome +(you'll have to go through the Jupyter file manager by following +the menu File -> Open, then select it, Shut it down, and Move +and/or Rename). +

  8. +
+
Importing an already existing notebook
If your notebook is +already in your GitLab project, then simply synchronize by using +the Git pull button and use the File -> Open menu. Otherwise, +imagine, you want to import the following notebook from someone +else's repository to re-execute it. +
    +
  1. Download the file on your computer. E.g., for this GitLab hosted +notebook, click on Open raw (a small </> within a document icon) +and save (Ctrl-S on most browsers) the content (a long Json text +file).
  2. +
  3. Open the Jupyter file manager from the menu File -> Open and +navigate to the directory where you want to upload your notebook.
  4. +
  5. Then from the top right button, Upload the previously downloaded +notebook and confirm the upload.
  6. +
  7. Open the freshly uploaded notebook through the Jupyter file +manager.
  8. +
+
+
+
+
+

Running R and Python in the same notebook

+

rpy2 package allows to use both languages in the same notebook by:

@@ -82,9 +131,9 @@ python cell.

-
-

Other languages

-
+
+

Other languages

+

Jupyter is not limited to Pytyhon and R. Many other languages are available: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels, including @@ -114,9 +163,9 @@ and environment control will certainly help anyway.

-
-

2. Installing and configuring Jupyter on your computer

-
+
+

2. Installing and configuring Jupyter on your computer

+

In this section, we explain how to set up a Jupyter environment on your own computer similar to the one deployed for this MOOC. @@ -131,9 +180,9 @@ benefit from JupyterLab which was still under active development. You may, howev

-
-

2.1 Installing Jupyter

-
+
+

2.1 Installing Jupyter

+

Follow these instructions if you wish to have a Jupyter environment on your own computer similar to the one we set up for this MOOC. @@ -166,18 +215,18 @@ jupyter notebook

-
-

2.2 Making sure Jupyter allows you to use R

-
+
+

2.2 Making sure Jupyter allows you to use R

+

The environment described in the last section should include R, but if you proceeded otherwise and only have Python available in Jupyter, you may want to read the following section.

-
-

• Installing IRKernel (R package)

-
+
+

• Installing IRKernel (R package)

+

Do the following in R console:

@@ -213,9 +262,9 @@ IRkernel::installspec() #
-
-

• Installing rpy2 (Python package)

-
+
+

• Installing rpy2 (Python package)

+

On Linux, the rpy2 package is available in standard distributions

@@ -258,13 +307,13 @@ Install also tzlocal:
-
-

2.3 Additional tips

-
+
+

2.3 Additional tips

+
-
-

• Exporting a notebook

-
+
+

• Exporting a notebook

+

Here is what we had to install on a recent Debian computer to make sure the notebook export via LaTeX works: @@ -309,9 +358,9 @@ packages when exporting to pdf.

-
-

• Improving notebook readability

-
+
+

• Improving notebook readability

+

Here are a few extensions that can ease your life:

@@ -338,9 +387,9 @@ jupyter-serverextension enable --py hide_code
-
-

• Interacting with GitLab and GitHub

-
+
+

• Interacting with GitLab and GitHub

+

To ease your experience, we added pull/push buttons that allow you to commit and sync with GitLab. This development was specific to