Skip to content

Commit

Permalink
Fix #38: update for 24j (#40)
Browse files Browse the repository at this point in the history
* Revert to Jupyter 6
* Update and improve instructions
  • Loading branch information
mwermelinger committed Aug 22, 2024
1 parent 961f98d commit 8ad621b
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 47 deletions.
87 changes: 44 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,84 +5,83 @@ a modern operating system: Linux, macOS 11 (Big Sur) or later, Windows 10 or 11.
You can have your M269 book and TMAs in a cloud folder, but you must
install Python 3.11 and the M269 software on each computer you use.

You must open and close PowerShells and terminals as instructed below
for the software to be correctly installed and used.
Do _not_ use already opened PowerShells and terminals.

These instructions assume that you already have created your M269 folder and
have put the M269 book there, as instructed in the Resources tab of the M269 website.

If you need help with the following instructions, ask in the M269 Technical Forum.

## 1 Preparation

Before installing the M269 software, do the following:

1. Create your M269 folder, which is where you put the M269 book and TMAs.
The folder must be named `m269-24j` or `M269-24J` and
can be anywhere on your disk, including a cloud drive.
(You probably already did this step before you downloaded the M269 book.)
<!-- The following avoids unreadable notebook error. -->
If you're using Windows 10 and your M269 folder is on OneDrive,
then right-click your M269 folder and choose 'always keep on this device'.

2. Check if you have Python 3.11:
- Windows: open a PowerShell, enter `py -0` and see if 3.11 is listed
- Unix: open a terminal and enter `python3.11 -V`
1. Check if you have Python 3.11:
- **Windows**: open a PowerShell, enter `py -0` and see if 3.11 is listed
- **Unix**: open a terminal and enter `python3.11 -V`

If 3.11 isn't listed or you get an error message like `command not found`,
then go to the next step, otherwise go directly to step 4 (macOS) or 5 (Windows and Linux).

3. Install Python 3.11, even if you have a newer version.
2. Install Python 3.11, even if you have a newer version.
Do *not* uninstall any Python version you have.
- Windows: Follow [these instructions](https://support.microsoft.com/en-us/windows/which-version-of-windows-operating-system-am-i-running-628bec99-476a-2c13-5296-9dd081cdd808)
- **Windows**: Follow [these instructions](https://support.microsoft.com/en-us/windows/which-version-of-windows-operating-system-am-i-running-628bec99-476a-2c13-5296-9dd081cdd808)
to check if you have 32-bit or 64-bit Windows. Then download and run the
[32-bit installer](https://www.python.org/ftp/python/3.11.9/python-3.11.9.exe) or the
[64-bit installer](https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe).
After installing, disable the pathname limit if you're given that option.
- macOS: download and run the [installer](https://www.python.org/ftp/python/3.11.9/python-3.11.9-macos11.pkg)
- Linux: enter `sudo apt install python3.11` or similar (search online for instructions for your Linux distribution).
- **macOS**: download and run the [installer](https://www.python.org/ftp/python/3.11.9/python-3.11.9-macos11.pkg)
- **Linux**: enter `sudo apt install python3.11` or similar (search online for instructions for your Linux distribution).
If you're using a Debian-based distribution like Ubuntu, you must additionally
enter `sudo apt install python3.11-venv` or similar.

4. macOS only: open a terminal, enter `xcode-select --install` and follow the instructions.
3. **macOS**: open a terminal, enter `xcode-select --install` and follow the instructions.
If you get a message that the command line tools are already installed,
then this step is completed.

5. Close any PowerShell (Windows) or terminal (Unix) you have opened.
4. Close any PowerShell (Windows) or terminal (Unix) you have opened,
and proceed to the next section.

## 2 Installation

To avoid errors, we suggest that instead of typing the commands,
you select and copy them from this page and paste them into the command line.

1. Open a PowerShell (Windows) or a terminal (Unix).
1. Open a new PowerShell (Windows) or a new terminal (Unix).

2. Go to your M269 folder by entering `cd <M269 folder path>`, e.g. `cd ~/OU/m269-24j`.
(In PowerShell and Unix, `~` is a shorthand for your home folder.)

3. Download the installation script:
- Windows: `Invoke-WebRequest -Uri https://raw.githubusercontent.com/dsa-ou/m269-installer/main/install.ps1 -OutFile install.ps1`
- Unix: `curl -LO https://github.com/dsa-ou/m269-installer/raw/main/install.sh`
- **Windows**: `Invoke-WebRequest -Uri https://raw.githubusercontent.com/dsa-ou/m269-installer/main/install.ps1 -OutFile install.ps1`
- **Unix**: `curl -LO https://github.com/dsa-ou/m269-installer/raw/main/install.sh`

4. Allow the installation script to run:
- Windows: `Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser`
- **Windows**: `Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser`
and then select the `Y` (yes) option if you're given a choice
- Unix: `chmod +x install.sh`
- **Unix**: `chmod +x install.sh`

5. Run the installation script:
- Windows: `.\install.ps1`
- Unix: `./install.sh`
- **Windows**: `.\install.ps1`
- **Unix**: `./install.sh` and ignore a message about pytype and networkx being incompatible

On Unix, ignore a message about pytype and networkx being incompatible.

6. Close the terminal.
6. Close the PowerShell or terminal you opened in step 1.

You will have the following files in your M269 folder:
- the installation script in `install.ps1` (Windows) or `install.sh` (Unix)
- the list of M269 software in `requirements.txt`
- the list of M269 software common to Windows and Unix in `requirements.txt`
- the style changes to Jupyter notebooks in `custom.css`

We recommend you do _not_ remove these files, so that you can re-install
the software, if needed.
the software, if needed. Now proceed to the next section.

## 3 Usage

To work on the M269 notebooks, follow these steps.
You can press Tab to complete commands and pathnames.
Every time you want to work on the M269 notebooks, you need to follow the next 5 steps.
However, the first time you are using Jupyter, after installing the software,
just do the first 3 steps and return to the book to learn how to use Jupyter.

1. Open a new PowerShell (Windows) or a new terminal (Unix).

Expand All @@ -94,14 +93,14 @@ You can press Tab to complete commands and pathnames.
as that may change the M269 software installation and break it.

3. Enter `nb` to start working with notebooks.
After a little while, a web browser opens, with JupyterLab,
After a little while, a web browser opens, with the Jupyter dashboard
listing the contents of your M269 folder.
(You can now continue reading Section 1.3 of the book.)

4. After finishing working on the notebooks, select 'Shut down'
from JupyterLab's File menu, then close the browser tab.
4. After finishing working on the notebooks, go back to the web browser tab with
the Jupyter dashboard, click on the 'Quit' button, then close the browser tab.

5. Close the PowerShell (Windows) or terminal (Unix).
5. Close the PowerShell or terminal you opened in step 1.

**Note for macOS users**:
If steps 2 and 3 (the `m269-24j` and `nb` commands) are not working,
Expand All @@ -118,8 +117,8 @@ delete folder `~/venvs/m269-24j`.
If you also want to remove the `m269-24j` and `nb` commands:

1. Find out in which file they are defined.
- Windows: open a PowerShell and enter `$Profile.CurrentUserCurrentHost` to obtain the file name
- Unix: open a terminal and enter `echo $0` to obtain the shell you're using.
- **Windows**: open a PowerShell and enter `$Profile.CurrentUserCurrentHost` to obtain the file name
- **Unix**: open a terminal and enter `echo $0` to obtain the shell you're using.
If it's fish, then the commands are in file `~/.config/fish/config.fish`,
otherwise they're in file `~/.shellrc`, where `shell` is the name of your shell.
For example, if you're using bash, then it's file `~/.bashrc`.
Expand All @@ -145,16 +144,18 @@ If you haven't removed the installation files from your M269 folder,
you can re-install the software after uninstalling it,
e.g. to work again on your M269 notebooks. Do as follows:

1. Open a PowerShell (Windows) or a terminal (Unix).
1. Open a new PowerShell (Windows) or a new terminal (Unix).

2. Go to your M269 folder by entering `cd <M269 folder path>`, e.g. `cd ~/OU/m269-24j`.

3. Run the installation script with `.\install.ps1 .` (Windows) or `./install.sh .` (Unix).
Note the extra space and period after the command, compared to step 5 in Section 2.
(During re-installation, ignore messages about the usage of the `cp` command or
about a file being copied onto itself.)
3. Run the installation script as follows, ignoring messages about the `cp` command or
about a file being copied onto itself:
- **Windows**: `.\install.ps1 .`
- **Unix**: `./install.sh .`

**Note**: there's an extra space and period after the command, compared to step 5 in Section 2.
4. Close the terminal.
4. Close the PowerShell or terminal you opened in step 1.
## Licence
Expand Down
2 changes: 1 addition & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function m269-24j {
& "$VENV\Scripts\Activate.ps1"
}
function nb {
Start-process -NoNewWindow jupyter-lab -ArgumentList "--custom-css"
Start-process -NoNewWindow jupyter -ArgumentList "notebook"
}
function allowed {}
"@
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ echo "Adding shortcut commands to $shell's startup file..."

# if 23J's allowed alias exists, cancel it, otherwise don't show error message
M269="cd \"$FOLDER\";source $VENV/bin/activate;unalias allowed 2> /dev/null"
NB="jupyter-lab --custom-css &"
NB="jupyter notebook &"

if [ $shell = "fish" ]
then
Expand Down
22 changes: 20 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# DON'T edit this file. Generated in a fresh virtual environment with:
#
# pip install jupyter "notebook<7" rise jupyterlab_rise matplotlib networkx algoesup allowed ruff
# pip check
# pip freeze > requirements.txt

algoesup==0.3.1
allowed==1.5.0
anyio==4.4.0
Expand All @@ -20,6 +26,7 @@ cycler==0.12.1
debugpy==1.8.5
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==2.0.1
fastjsonschema==2.20.0
fonttools==4.53.1
Expand All @@ -30,33 +37,40 @@ httpx==0.27.0
idna==3.7
ipykernel==6.29.5
ipython==8.26.0
ipython-genutils==0.2.0
ipywidgets==8.1.3
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.4
json5==0.9.25
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.10.0
jupyter-lsp==2.2.5
jupyter_client==8.6.2
jupyter_client==7.4.9
jupyter_core==5.7.2
jupyter_server==2.14.2
jupyter_server_terminals==0.5.3
jupyterlab==4.2.4
jupyterlab_pygments==0.3.0
jupyterlab_rise==0.42.0
jupyterlab_server==2.27.3
jupyterlab_widgets==3.0.11
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.9.2
matplotlib-inline==0.1.7
mistune==3.0.2
nbclassic==1.1.0
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.3
notebook==6.5.7
notebook_shim==0.2.4
numpy==2.1.0
overrides==7.7.0
Expand All @@ -78,10 +92,13 @@ python-dateutil==2.9.0.post0
python-json-logger==2.0.7
PyYAML==6.0.2
pyzmq==26.1.1
qtconsole==5.5.2
QtPy==2.4.1
referencing==0.35.1
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rise==5.7.1
rpds-py==0.20.0
ruff==0.6.1
Send2Trash==1.8.3
Expand All @@ -93,11 +110,12 @@ terminado==0.18.1
tinycss2==1.3.0
tornado==6.4.1
traitlets==5.14.3
types-python-dateutil==2.9.0.20240316
types-python-dateutil==2.9.0.20240821
typing_extensions==4.12.2
uri-template==1.3.0
urllib3==2.2.2
wcwidth==0.2.13
webcolors==24.8.0
webencodings==0.5.1
websocket-client==1.8.0
widgetsnbextension==4.0.11

0 comments on commit 8ad621b

Please sign in to comment.