not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

276 lines
11 KiB

  1. \documentclass[pdftex,12pt]{artikel3}
  2. % Compile with: pdflatex
  3. % Settings for source listings.
  4. \usepackage[dvips,letterpaper,margin=1.1in]{geometry}
  5. \usepackage{listings,graphicx}
  6. \usepackage{url} % usage \href{}{}
  7. \usepackage{xcolor}
  8. %% \usepackage{soul}
  9. %% \usepackage{lipsum}
  10. \usepackage{mathtools}
  11. % \newcommand{\myul}[2][black]{\setulcolor{#1}\ul{#2}\setulcolor{black}}
  12. \usepackage{array}
  13. %% \usepackage{multirow}
  14. \usepackage{alltt}
  15. \usepackage{pifont}
  16. \usepackage{courier}
  17. \usepackage{fancyvrb}
  18. \usepackage{enumitem}
  19. \usepackage[hidelinks]{hyperref} % hide links in hyperref text
  20. \usepackage{cleveref} % nice table/figure refs. put after hyperref
  21. % sample stuff for tables and figs
  22. %\usepackage{blindtext}
  23. \usepackage{makeidx} % for makeindex
  24. \usepackage{tocloft} % for nicely formatted toc, tof, lof
  25. \usepackage{booktabs,longtable,tabu}
  26. \usepackage[utf8]{inputenc}
  27. \usepackage[T1]{fontenc}
  28. \usepackage{imakeidx}
  29. %% preamble
  30. % the tabfigref command outputs a table or figure reference
  31. % with pattern: "Figure N, The Caption," or "Table N, The Caption,"
  32. % Note: output has a trailing comma(,) for phrasing.
  33. \newcommand{\tabfigref}[1]{\autoref{#1}, \nameref{#1},}
  34. \setcounter{tocdepth}{3}
  35. \makeindex[columns=2, title=Alphabetical Index, intoc]
  36. \lstset{tabsize=4,language=Python,showstringspaces=false}
  37. \title{
  38. \begin{center}
  39. \huge{Jupyter Notebook User Document} \\
  40. \huge{CSCI-471-02}\\
  41. \end{center}
  42. \\
  43. \\
  44. \\
  45. \\
  46. \\
  47. \author{} % \author{Jeffery B. Russell} \\
  48. % \author{Dan Moore}
  49. \date{} % \date{Febuary 20, 2020}
  50. }
  51. %% document starts
  52. \begin{document}
  53. \maketitle
  54. \begin{center}
  55. \author{Jeffery B. Russell}
  56. \author{Dan Moore}
  57. \author{Louden Yandow}
  58. \date{Febuary 20, 2020}
  59. \end{center}
  60. \newpage
  61. \tableofcontents
  62. \addtocontents{toc}{~\hfill\textbf{Page}\par}
  63. \addcontentsline{toc}{section}{\listfigurename} % include lists of figs
  64. \newpage
  65. \listoffigures
  66. \addtocontents{lof}{~\hfill\textbf{Page}\par}
  67. \newpage
  68. \section{Introduction}
  69. Jupyter \index{jupyter} is an open-source web-based notebook tool that you can use as your development environment.
  70. A coding notebook enables you to intermix markdown, and code blocks that you can execute in a single document. This is heavily used in the education and research fields because it makes writing reports easy and reproducible. With Jupyter you can create content that has live code, equations, visualizations and explanatory text.
  71. Jupyter Lab extends the basic notebook functionality and provides you a full web environment to work in. Using this interface you can open terminals, manage files, and even tile multiple editors.
  72. Applications of Jupyter Jab:
  73. \begin{itemize}
  74. \item Quick experimentation
  75. \item Telling a story with data
  76. \item Writing a report
  77. \item Sharing code snippets for education
  78. \end{itemize}
  79. In this document we are going to go over the basic installation and usage of Jupyter Lab for personal use developing python\index{python}. In the advanced usage section we go over how to use Jupyter on a remote server. This is particularly useful when you want to run algorithms on a remote computer.
  80. \section{Installation}
  81. \subsection{Dependencies}
  82. \subsection{Installation on Windows}
  83. \subsection{Installation on Linux}
  84. \section{Usage}
  85. To run Jupyter Lab, open your computer's command terminal and enter the following command. This will open Jupyter Lab in your default web browser.
  86. \texttt{jupyter lab}
  87. \tabfigref{fig:jupyterlablauncher} is what you will see upon first running Jupyter Lab. Otherwise, it can open to the most recent notebook you were working on.
  88. \begin{figure}[h!]
  89. \centering
  90. \includegraphics[width=65mm]{launcher.png}
  91. \caption{Default Jupyter Lab launcher}
  92. \label{fig:jupyterlablauncher}
  93. \end{figure}
  94. \subsection{Navigation}
  95. Once Jupyter Lab is running, you will see on the left side of the screen a column of icons. Each icon will open a different panel to the right of it when you click it. From top to bottom, these icons have the following functions:
  96. \begin{itemize}
  97. \item File Browser (folder icon): displays a file browser for the user to open, move, or delete their files.
  98. \item Running Terminals and Kernels (square stop button inside a circle): shows the user all currently active terminal and kernel sessions.
  99. \item Commands (palette icon): allows the user to enter various commands into Jupyter Lab.
  100. \item Notebook Tools (wrench icon): shows various options for the user's current notebook.
  101. \item Open Tabs (a tabbed window icon): lists all currently open tabs in Jupyter Lab.
  102. \end{itemize}
  103. Additionally, the top toolbar contains the following different drop-down menus: File, Edit, View, Run, Kernel, Tabs, Settings, and Help.
  104. \subsection{Creating a Notebook}
  105. To create a notebook (the working document for both python code and text markdown) from the launcher (\tabfigref{fig:jupyterlablauncher}), click on the Python 3 icon under the orange notebook symbol. Alternatively, if you don't have the launcher open, you can click on File in the toolbar, click New, and finally click Notebook.
  106. This will open an empty, untitled notebook. If you right click on the tab above, or on the name of your notebook in the "Open Tabs" panel on the left, you can rename your notebook.
  107. \subsection{Running a Notebook}
  108. With a notebook open, you can start writing in the editor, the big empty area on the right half of the screen. Just above the editor, you will find the icon to save the open notebook.
  109. There are also a number of icons that directly relate to the "cells" you are writing in. A cell is either python code, markdown, or raw text. You can change what type of text a cell is by clocking on the drop-down menu just above the editor that will say either "Code", "Markdown", or "Raw".
  110. Notebooks work through these cells, in order from top to bottom. The icons above the editor, from left to right, do the following:
  111. \begin{itemize}
  112. \item add a cell after the currently selected cell.
  113. \item cut the currently selected cells.
  114. \item copy the selected cells.
  115. \item paste the cells from the clipboard.
  116. \item run the selected cells and advance to the next cell.
  117. \item interrupt the kernel.
  118. \item and restart the kernel.
  119. \end{itemize}
  120. The following example shows how to write code, run code, and insert raw text into the notebook. First, write some python code and click the "Run selected cells and advance" button (circled in red in the figure below). Our output is shown in the next figure (output is given its own unique cell immediately after the cell that produced it).
  121. \begin{figure}[h!]
  122. \centering
  123. \includegraphics[width=15cm]{code_before_running.png}
  124. \caption{Code before being run}
  125. \label{fig:codebeforerunning}
  126. \end{figure}
  127. \begin{figure}[h!]
  128. \centering
  129. \includegraphics[width=15cm]{code_after_running.png}
  130. \caption{Code after being run}
  131. \label{fig:codeafterrunning}
  132. \end{figure}
  133. You can also insert raw text into your document, as shown below. To do this, change the drop-down menu from Code (or Markdown) to Raw, and type what you want in the cell.
  134. \begin{figure}[h!]
  135. \centering
  136. \includegraphics[width=15cm]{raw_text_example.png}
  137. \caption{Example of raw text}
  138. \label{fig:rawtextexample}
  139. \end{figure}
  140. \subsection{Exporting Documents}
  141. \subsection{Customization}
  142. \section{Advanced Usage}
  143. In this section we are going to go over how to use multiple programming languages in Jupyter and how to connect to your Jupyter Lab instance remotely.
  144. \subsection{Multiple Kernels}
  145. \subsection{Remote Connection}
  146. If you have a firewall Jupyter Lab will only be available on your
  147. local machine at "localhost:8888", however, it is possible to connect to Jupyter Lab from remote computers.
  148. This is helpful because you can connect to the same Jupyter instance from multiple computers. This would also save you resources on your local computer so you can program on a lightweight chrome-book that would not be able to run a full IDE\index{IDE} like Pycharm\index{pycharm}.
  149. The first step to enable remote host would be to set a password that you can connect to the notebook using. You can set a password that you use to log into the website using the following command:
  150. \texttt{jupyter notebook password}
  151. The Second step would be to launch the Jupyter Lab instance in a headless environment -- it never launches a web browser.
  152. \texttt{jupyter lab --no-browser --port=6000}
  153. The final step is to connect to the Jupyter Lab instance from your
  154. remote computer. The easiest way to do this is via a local port
  155. forward in SSH\index{ssh}. This command essentially forwards all of the traffic on your local machine on a specific port to a remote computer over a ssh connection. The main benefit of doing this is that all the traffic over the connection is encrypted.
  156. \tabfigref{fig:jupyterlablauncher} shows an overview of what the network archetecture looks like.
  157. \texttt{ssh -L 6000:localhost:6000 user@remote-host}
  158. \begin{figure}[h!]
  159. \centering
  160. \includegraphics[width=15cm]{remoteJupyter.png}
  161. \caption{Network Overview}
  162. \label{fig:jupyter_server}
  163. \end{figure}
  164. After you execute the command above on your remote computer you
  165. would be able to access your Jupyter Lab instance on your computers "localhost:6000".
  166. \newpage
  167. \section{Glossary}
  168. \begin{itemize}[label={}]
  169. \item {\bf Jupyter}: Nonprofit organization created to "develop open-source software, open-standards, and services for interactive computing across dozens of programming languages" \footnote{\url{ https://jupyter.org/}}.\index{jupyter}\\
  170. \item {\bf Python}: High-level interpreted, general purpose programming language \footnote{\url{ https://www.python.org/}}.\index{python}\\
  171. \item {\bf Markdown(MD)}: Lightweight markup-language \footnote{\url{https://en.wikipedia.org/wiki/Markdown}}.\index{markdown}\\
  172. \item {\bf pip}: Tool for installing and managing python packages \footnote{\url{ https://pypi.org/project/pip/}}.\index{pip}\\
  173. \item {\bf Scala}: General purpose functional programming language that runs on the JVM \footnote{\url{ https://scala-lang.org/}}.\index{scala}\\
  174. \item {\bf R}: Programming language for statistical computing and graphics \footnote{\url{ https://www.r-project.org/}}.\index{r}\\
  175. \item {\bf Pycharm}: A popular versitile python IDE developed by \href{https://www.jetbrains.com/}{Jetbrains}.\index{IDE}\\
  176. \item {\bf IDE}: Interactive Development Environment.\index{IDE}\\
  177. \item {\bf ssh}: Secure Socket Shell -- used in connecting to a remote computer over a encrypted channel.\index{ssh}\\
  178. \end{itemize}
  179. \newpage
  180. \section{References}
  181. \begin{enumerate}
  182. \item
  183. \url{https://jupyter.org/}
  184. \item
  185. \url{https://www.python.org/}
  186. \item
  187. \url{https://en.wikipedia.org/wiki/Markdown}
  188. \item
  189. \url{https://pypi.org/project/pip/}
  190. \item
  191. \url{https://scala-lang.org/}
  192. \item
  193. \url{https://www.r-project.org/}
  194. \item
  195. \url{https://www.jetbrains.com/}
  196. \end{enumerate}
  197. \newpage
  198. %\section{Index}
  199. \printindex
  200. % outputs its own heading, which does not match the sections
  201. \end{document}