Jupyter

environmentshellformpython

Tips and tricks

Reload modified modules automatically

%load_ext autoreload
%autoreload 2

Modules edited on disk are reloaded before each cell execution, so code changes are picked up without restarting the kernel. Reference: IPython autoreload documentation

Install a package without restarting the kernel

%pip install bokeh

%pip installs into the environment of the running kernel, which is what you want. The older !pip install ... form runs pip as a plain shell command and can target the wrong Python when several are installed. The ! prefix itself is the general tool here: it runs any shell command from a cell (!ls, !curl ...).

Related