Skip to content

Commit fc85133

Browse files
setup rough done
1 parent 698f82c commit fc85133

File tree

2 files changed

+53
-168
lines changed

2 files changed

+53
-168
lines changed

img/setup/jlab-2.png

61.4 KB
Loading

source/setup.Rmd

Lines changed: 53 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -202,202 +202,87 @@ Run JupyterLab Desktop using the command
202202
```
203203
jlab
204204
```
205-
You will see python environment not found. click to use the bundled installer
205+
Next, in the JupyterLab Desktop graphical interface that appears (Figure \@ref(fig:setup-jlab-gui)),
206+
you will see text at the bottom saying "Python environment not found". Click "Install using the bundled installer"
207+
to set up the environment.
206208

207-
Next, we need to add the JupyterLab Git extension so that
208-
we can use version control directly from within JupyterLab Desktop.
209-
In JupyterLab Desktop, click "New notebook...", and run the following code in a cell:
209+
```{r setup-jlab-gui, echo = FALSE, message = FALSE, warning = FALSE, fig.cap = "The JupyterLab Desktop graphical user interface.", out.width="85%", fig.align = "center", fig.retina = 2}
210+
knitr::include_graphics("img/setup/jlab-1.png")
210211
```
211-
%pip install --upgrade jupyterlab-git
212-
```
213-
To have the software \index{R installation} used in this book available to you in JupyterLab,
214-
you will need to install the R programming language via the IRkernel.
215-
Run the following code in another cell:
216-
```
217-
%conda install -c conda-forge r-irkernel
212+
213+
Next, we need to add the JupyterLab Git extension (so that
214+
we can use version control directly from within JupyterLab Desktop),
215+
the IRkernel (to enable the R programming language),
216+
and various R software packages. Click "New session..." in the JupyterLab Desktop
217+
user interface, then scroll to the bottom, and click "Terminal" under the "Other" heading (Figure \@ref(fig:setup-jlab-gui-2)).
218+
```{r setup-jlab-gui-2, echo = FALSE, message = FALSE, warning = FALSE, fig.cap = "A JupyterLab Desktop session, showing the Terminal option at the bottom.", out.width="85%", fig.align = "center", fig.retina = 2}
219+
knitr::include_graphics("img/setup/jlab-2.png")
218220
```
219-
Finally, you will need several R packages.
220-
To install versions of these that are compatible with the accompanying worksheets,
221-
type the command shown below into into another cell:
221+
In this terminal, run the following commands:
222222
```
223-
%conda env update --file https://raw.githubusercontent.com/UBC-DSCI/data-science-a-first-intro-worksheets/main/environment.yml
223+
pip install --upgrade jupyterlab-git
224+
conda env update --file https://raw.githubusercontent.com/UBC-DSCI/data-science-a-first-intro-worksheets/main/environment.yml
224225
```
225-
This command installs the specific R and package versions specified in
226+
The second command installs the specific R and package versions specified in
226227
the `environment.yml` file found in
227228
[the worksheets repository](https://worksheets.datasciencebook.ca).
228229
We will always keep the versions in the `environment.yml` file updated
229230
so that they are compatible with the exercise worksheets that accompany the book.
230231

231232
> You can also install the *latest* version of R
232-
> and the R packages used in this book by typing the commands shown below
233-
> in the Anaconda Prompt (Windows)
234-
> or terminal (MacOS and Ubuntu) and pressing enter.
233+
> and the R packages used in this book by instead typing the commands shown below
235234
> **Be careful though:** this may install package versions that are
236235
> incompatible with the worksheets that accompany the book; the automated
237236
> exercise feedback might tell you your answers are not correct even though
238237
> they are!
239238
>
240239
> ```
241-
> %conda install -c conda-forge r-base r-cowplot r-ggally r-gridextra
242-
> %conda install -c conda-forge r-kknn r-rpostgres r-rsqlite r-scales r-testthat
243-
> %conda install -c conda-forge r-tidymodels r-tidyverse unixodbc
240+
> pip install --upgrade jupyterlab-git
241+
> conda install -c conda-forge r-base r-cowplot r-ggally r-gridextra
242+
> conda install -c conda-forge r-kknn r-rpostgres r-rsqlite r-scales r-testthat
243+
> conda install -c conda-forge r-tidymodels r-tidyverse unixodbc
244244
> ```
245245
246-
### Windows
247-
248-
TODO
249-
250-
### MacOS
251-
252-
TODO
253-
254-
255-
256-
- jupyterlab-git
257-
conda install -c conda-forge -y jupyterlab
258-
conda install -y nodejs
259-
pip install --upgrade jupyterlab-git
260-
261-
R, R packages, and the IRkernel
262-
263-
## Finishing up installation
264-
265-
It is good practice to restart all the programs you used when installing this
266-
software before you proceed to doing your data analysis.
267-
This includes restarting JupyterLab as well as the terminal (MacOS and Ubuntu)
268-
or the Anaconda Prompt (Windows).
246+
Once all of the software installation is complete, it is a good idea to restart
247+
JupyterLab Desktop entirely before you proceed to doing your data analysis.
269248
This will ensure all the software and settings you put in place are
270-
correctly sourced.
249+
correctly set up and ready for use.
271250
251+
### Windows
272252
273-
## OLD MATERIAL
253+
First, we will install Git for version control.
254+
Go to [the Git download page](https://git-scm.com/download/win) and
255+
download the Windows version of Git. Once the download has finished, run the installer and accept
256+
the default configuration for all pages.
257+
Next, visit the ["Installation" section of the JupyterLab Desktop homepage](https://github.com/jupyterlab/jupyterlab-desktop#installation).
258+
Download the `JupyterLab-Setup-Windows.exe` installer file for Windows.
259+
Double-click the installer to run it, use the default settings.
260+
Run JupyterLab Desktop by clicking the icon on your desktop.
274261
275-
### Git
262+
From this point onward, with JupyterLab Desktop running,
263+
follow the instructions in the Ubuntu section on how to set up the
264+
environment, install the JupyterLab Git extension, and install
265+
the various R software packages needed for the worksheets.
276266
277-
As shown in Chapter \@ref(Getting-started-with-version-control),
278-
Git \index{git!installation} is a very useful tool for version controlling your projects,
279-
as well as sharing your work with others. Here's how to install Git on
280-
the following operating systems:
281267
282-
**Windows:** To install
283-
Git on Windows, go to <https://git-scm.com/download/win> and download the Windows
284-
version of Git. Once the download has finished, run the installer and accept
285-
the default configuration for all pages.
268+
### MacOS
286269
287-
**MacOS:** To install Git on Mac OS,
288-
open the terminal ([how-to video](https://youtu.be/5AJbWEWwnbY))
270+
First, we will install Git for version control.
271+
Open the terminal ([how-to video](https://youtu.be/5AJbWEWwnbY))
289272
and type the following command:
290273
291274
```
292275
xcode-select --install
293276
```
294-
295-
**Ubuntu:** To install Git on Ubuntu, open the terminal
296-
and type the following commands:
297-
298-
```
299-
sudo apt update
300-
sudo apt install git
301-
```
302-
303-
304-
### Miniconda
305-
306-
To run Jupyter notebooks on your computer,
307-
you will need to install the web-based platform JupyterLab.
308-
But JupyterLab relies on Python, so we need to install Python first.
309-
We can install Python via
310-
the \index{miniconda} [miniconda Python package distribution](https://docs.conda.io/en/latest/miniconda.html).
311-
312-
**Windows:** To install miniconda on Windows, download
313-
the [latest Python 64-bit version from here](https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe).
314-
Once the download has finished, run the installer
315-
and accept the default configuration for all pages.
316-
After installation, you can open the Anaconda Prompt
317-
by opening the Start Menu and searching for the program called
318-
"Anaconda Prompt (miniconda3)".
319-
When this opens, you will see a prompt similar to
320-
`(base) C:\Users\your_name`.
321-
322-
**MacOS:** To install miniconda on MacOS, you will need to use a different
323-
installation method depending on the type of processor chip your computer has.
324-
325-
If your Mac computer has an Intel x86 processor chip you can download
326-
the [latest Python 64-bit version from here](https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.pkg).
327-
After the download has finished, run the installer and accept the default
328-
configuration for all pages.
329-
330-
If your Mac computer has an Apple M1 processor chip you can download
331-
the [latest Python 64-bit version from here](https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh).
332-
After the download has finished, you need to run the downloaded script in the terminal using a command
333-
like:
334-
335-
```
336-
bash path/to/Miniconda3-latest-MacOSX-arm64.sh
337-
```
338-
339-
Make sure to replace `path/to/` with the path of the folder
340-
containing the downloaded script. Most computers will save downloaded files to the `Downloads` folder.
341-
If this is the case for your computer, you can run the script in the terminal by typing:
342-
343-
```
344-
bash Downloads/Miniconda3-latest-MacOSX-arm64.sh
345-
```
346-
347-
The instructions for the installation will then appear.
348-
Follow the prompts and agree to accepting the license,
349-
the default installation location,
350-
and to running `conda init`, which makes `conda` available from the terminal.
351-
352-
**Ubuntu:** To install miniconda on Ubuntu, first download
353-
the [latest Python 64-bit version from here](https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh).
354-
After the download has finished, open the terminal and execute the following
355-
command:
356-
357-
```
358-
bash path/to/Miniconda3-latest-Linux-x86_64.sh
359-
```
360-
361-
Make sure to replace `path/to/` with the path of the folder containing the downloaded
362-
script. Most often this file will be downloaded to the `Downloads` folder.
363-
If this is the case for your computer, you can run the script in the terminal by typing:
364-
365-
```
366-
bash Downloads/Miniconda3-latest-Linux-x86_64.sh
367-
```
368-
369-
The instructions for the installation will then appear.
370-
Follow the prompts and agree to accepting the license,
371-
the default installation location,
372-
and to running `conda init`, which makes `conda` available from the terminal.
373-
374-
### JupyterLab
375-
376-
With miniconda set up, we can now install JupyterLab \index{JupyterLab installation} and the Jupyter Git \index{git!Jupyter extension} extension.
377-
Type the following into the Anaconda Prompt (Windows) or the terminal (MacOS and Ubuntu) and press enter:
378-
379-
```
380-
conda install -c conda-forge -y jupyterlab
381-
conda install -y nodejs
382-
pip install --upgrade jupyterlab-git
383-
```
384-
385-
To test that your JupyterLab installation is functional, you can type
386-
`jupyter lab` into the Anaconda Prompt (Windows)
387-
or terminal (MacOS and Ubuntu) and press enter. This should open a new
388-
tab in your default browser with the JupyterLab interface. To exit out of
389-
JupyterLab you can click `File -> Shutdown`, or go to the terminal from which
390-
you launched JupyterLab, hold `Ctrl`, and press `C` twice.
391-
392-
To improve the experience of using R in JupyterLab, you should also add an extension
393-
that allows you to set up keyboard shortcuts for inserting text.
394-
By default,
395-
this extension creates shortcuts for inserting two of the most common R
396-
operators: `<-` and `|>`. Type the following in the Anaconda Prompt (Windows)
397-
or terminal (MacOS and Ubuntu) and press enter:
398-
399-
```
400-
jupyter labextension install @techrah/text-shortcuts
401-
```
402-
403-
277+
Next, visit the ["Installation" section of the JupyterLab Desktop homepage](https://github.com/jupyterlab/jupyterlab-desktop#installation).
278+
Download the `JupyterLab-Setup-MacOS-x64.dmg` or `JupyterLab-Setup-MacOS-arm64.dmg` installer file
279+
(you need to know whether your computer has an Intel processor an
280+
Apple processor). Double-click the file to open the installer, then drag
281+
the JupyterLab Desktop icon to the Applications folder. Double-click
282+
the icon in the
283+
Applications folder to start JupyterLab Desktop.
284+
285+
From this point onward, with JupyterLab Desktop running,
286+
follow the instructions in the Ubuntu section on how to set up the
287+
environment, install the JupyterLab Git extension, and install
288+
the various R software packages needed for the worksheets.

0 commit comments

Comments
 (0)