Skip to content

Commit 142322c

Browse files
authored
Update restart kernel code (#200)
1 parent 0d8c213 commit 142322c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/labs/tools/jupyterlab/overview.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ Follow these best practices when creating JupyterLab labs:
118118
- Pin python package versions when installing using `conda` or `mamba`. For instance, instead of using `!mamba install -c conda-forge -y matplotlib`, use `!mamba install -c conda-forge -y matplotlib==3.10.0`
119119
- Ask learners to restart their kernel between installing Python libraries and importing them. There are several ways that this can be accomplished. You can include a code cell that, when run, restarts the kernel:
120120
```python
121-
import os
122-
os._exit(00)
121+
# Restart the kernel
122+
from IPython import get_ipython
123+
get_ipython().kernel.do_shutdown(restart=True)
123124
```
124125
And, as a workaround in case the above code fails to restart the kernel for a learner, you can include the following image in a markdown cell that asks the learner to click the kernel restart button:
125126
![An image that shows the location of the jupyterlab restart kernel button](/img/labs/restart-jupyterlab-kernel.png)

0 commit comments

Comments
 (0)