Update the installation notes to JupyterLab
This commit is contained in:
parent
759271b6a1
commit
e8cd8a7e63
6 changed files with 49 additions and 24 deletions
|
@ -156,7 +156,7 @@
|
|||
"\n",
|
||||
"A popular and beginner-friendly way is to install the [Anaconda Distribution](https://www.anaconda.com/distribution/) that not only ships Python and the standard library but comes pre-packaged with a lot of third-party libraries from the so-called \"scientific stack.\" Just go to the [download](https://www.anaconda.com/download/) page and install the latest version (i.e., *2019-10* with Python 3.7 at the time of this writing) for your operating system.\n",
|
||||
"\n",
|
||||
"Then, among others, you find an entry \"Jupyter Notebook\" in your start menu like below. Click on it to open a new tab in your web browser where you can switch between folders as you could in your computer's default file browser."
|
||||
"Then, among others, you will find an entry \"Anaconda Navigator\" in your start menu like below. Click on it."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -167,7 +167,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"<img src=\"static/anaconda.png\" width=\"40%\">"
|
||||
"<img src=\"static/anaconda_start_menu.png\" width=\"30%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -178,7 +178,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"To download the materials accompanying this book as a ZIP file, open this [GitHub repository](https://github.com/webartifex/intro-to-python) in a web browser and click on the green \"Clone or download\" button on the right. Then, unpack the ZIP file into a folder of your choosing (ideally somewhere within your user folder so that the files show up right away)."
|
||||
"A window opens showing you several applications that come with the Anaconda Distribution. Now, click on \"JupyterLab.\""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -189,7 +189,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"### Alternative Installation"
|
||||
"<img src=\"static/anaconda_navigator.png\" width=\"50%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -200,7 +200,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"Python can also be installed in a \"pure\" way as obtained from its core development team. However, this is somewhat too \"advanced\" for a beginner who would then also be responsible for setting up all the third-party libraries needed to view this document. Plus, many of the involved steps are typed in a [terminal](https://en.wikipedia.org/wiki/Terminal_emulator) window, which tends to be a bit intimidating for most beginners."
|
||||
"A new tab in your web browser opens with the website being \"localhost\" and some number (e.g., 8888). This is the [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) application that is used to display and run the Jupyter notebooks mentioned above. On the left, you see the files and folders in your local user folder. This file browser works like any other. In the center, you have several options to launch a new notebook file."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -211,7 +211,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"<img src=\"static/terminal.png\" width=\"50%\" align=\"center\">"
|
||||
"<img src=\"static/jupyter_lab.png\" width=\"50%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -222,7 +222,7 @@
|
|||
}
|
||||
},
|
||||
"source": [
|
||||
"For more \"courageous\" beginners wanting to learn how to accomplish this, here is a rough sketch of the aspects to know. First, all Python releases are available for free on the official [download](https://www.python.org/downloads/) page for any supported operating system. Choose the latest one applicable, then download and install it (cf., the [instruction notes](https://wiki.python.org/moin/BeginnersGuide/Download)). As this only includes core Python and the standard library, the beginner then needs to learn about the [pip](https://pip.pypa.io/en/stable/) module. With the command `python -m pip install jupyter`, all necessary third-party libraries are installed (cf., more background [here](https://jupyter.readthedocs.io/en/latest/install.html)). However, this would be done in a *system-wide* fashion and is not recommended. Instead, the best practice is to create a so-called **virtual environment** with the [venv](https://docs.python.org/3/library/venv.html) module with which the installed third-party packages are *isolated* on a per-project basis (the command `python -m venv env-name` creates a virtual environment called \"env-name\"). This tactic is employed to avoid a situation known as **[dependency hell](https://en.wikipedia.org/wiki/Dependency_hell)**. Once created, the virtual environment must then be activated each time before resuming work in each terminal (with the command `source env-name/bin/activate`). While there exist convenience tools that automate parts of this (e.g., [poetry](https://poetry.eustace.io/docs/) or [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)), it only distracts a beginner from studying the Python language. Yet, it is still worthwhile to have heard about these terms and concepts as many online resources often implicitly assume the user to know about them."
|
||||
"Next, to download the materials accompanying this book as a ZIP file, open this [GitHub repository](https://github.com/webartifex/intro-to-python) in a web browser, and click on the green \"Clone or download\" button on the top right. Then, unpack the ZIP file into a folder of your choosing, ideally somewhere within your personal user folder so that the files show up right away in JupyterLab."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
59
README.md
59
README.md
|
@ -91,33 +91,52 @@ Just go to the [download](https://www.anaconda.com/distribution/#download-sectio
|
|||
section and install the latest version (i.e., *2019-10* with Python 3.7 at the
|
||||
time of this writing) for your operating system.
|
||||
|
||||
Then, among others, you will find an entry "Jupyter Notebook" in your start
|
||||
Then, among others, you will find an entry "Anaconda Navigator" in your start
|
||||
menu like below.
|
||||
Click on it and a new tab in your web browser will open where you can switch
|
||||
between folders as you could in your computer's default file browser.
|
||||
Click on it.
|
||||
|
||||
<img src="static/anaconda.png" width="50%">
|
||||
<img src="static/anaconda_start_menu.png" width="30%">
|
||||
|
||||
To download the course's materials as a ZIP file, click on the green "Clone or
|
||||
download" button on the top right on this website.
|
||||
Then, unpack the ZIP file into a folder of your choosing (ideally somewhere
|
||||
within your personal user folder so that the files show up right away).
|
||||
A window opens showing you several applications that come with the Anaconda
|
||||
Distribution.
|
||||
Now, click on "JupyterLab."
|
||||
|
||||
<img src="static/anaconda_navigator.png" width="50%">
|
||||
|
||||
A new tab in your web browser opens with the website being "localhost" and some
|
||||
number (e.g., 8888).
|
||||
This is the [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/)
|
||||
application that is used to display and run the Jupyter notebooks mentioned
|
||||
above.
|
||||
On the left, you see the files and folders in your local user folder.
|
||||
This file browser works like any other.
|
||||
In the center, you have several options to launch a new notebook file.
|
||||
|
||||
<img src="static/jupyter_lab.png" width="50%">
|
||||
|
||||
Next, to download the course's materials as a ZIP file, click on the green
|
||||
"Clone or download" button on the top right on this website.
|
||||
Then, unpack the ZIP file into a folder of your choosing, ideally somewhere
|
||||
within your personal user folder so that the files show up right away in
|
||||
JupyterLab.
|
||||
|
||||
|
||||
### Alternative Installation
|
||||
### Alternative Installation (for Instructors)
|
||||
|
||||
Python can also be installed in a "pure" way as obtained from its core
|
||||
development team (i.e., without any third-party packages installed).
|
||||
However, this is somewhat too "advanced" for a beginner as it involves working
|
||||
with a terminal emulator, which looks similar to the picture below and is
|
||||
used without a mouse by typing commands into it.
|
||||
However, this may be too "advanced" for a beginner as it involves working
|
||||
with a [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator),
|
||||
which looks like the one in the picture below and is used *without* a mouse by
|
||||
typing commands into it.
|
||||
|
||||
<img src="static/terminal.png" width="50%" align="center">
|
||||
|
||||
Assuming that you already have a working version of Python 3.7 or higher
|
||||
installed (cf., the official [download page](https://www.python.org/downloads/)),
|
||||
the following summarizes the commands to be typed into a terminal emulator to
|
||||
get the course materials up and running on a local machine without Anaconda.
|
||||
get the course materials up and running on a local machine without the
|
||||
Anaconda Distribution.
|
||||
You are then responsible for understanding the concepts behind them.
|
||||
|
||||
First, the [git](https://git-scm.com/) command line tool is a more professional
|
||||
|
@ -156,17 +175,23 @@ are popular tools to automate the described management of virtual environments.
|
|||
|
||||
After activation for the first time, you must install the project's
|
||||
**dependencies** (= the third-party packages needed to run the code), most
|
||||
notably [Jupyter](https://pypi.org/project/jupyter/) in this project (the
|
||||
"python -m" is often left out [but should not be](https://snarky.ca/why-you-should-use-python-m-pip/);
|
||||
notably [JupyterLab](https://pypi.org/project/jupyterlab/) in this project
|
||||
(the "python -m" is often left out [but should not be](https://snarky.ca/why-you-should-use-python-m-pip/);
|
||||
if you have poetry installed, you may just type `poetry install` instead).
|
||||
|
||||
- `python -m pip install -r requirements.txt`
|
||||
|
||||
The *requirements.txt* file also installs the [black](https://github.com/psf/black)
|
||||
tool (incl. the [blackcellmagic](https://github.com/csurfer/blackcellmagic)
|
||||
extension) and the [RISE](https://github.com/damianavila/RISE) extension.
|
||||
With them, the instructor can easily re-format code in a class session and
|
||||
execute code in presentation mode (currently RISE only works with the
|
||||
older `jupyter notebook` command).
|
||||
|
||||
With everything installed, you can now do the equivalent of clicking the
|
||||
"Jupyter Notebook" entry in your start menu.
|
||||
"JupyterLab" entry in the Anaconda Navigator.
|
||||
|
||||
- `jupyter notebook`
|
||||
- `jupyter lab`
|
||||
|
||||
This opens a new tab in your web browser just as above.
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 139 KiB |
BIN
static/anaconda_navigator.png
Normal file
BIN
static/anaconda_navigator.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 310 KiB |
BIN
static/anaconda_start_menu.png
Normal file
BIN
static/anaconda_start_menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
BIN
static/jupyter_lab.png
Normal file
BIN
static/jupyter_lab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 127 KiB |
Loading…
Reference in a new issue