Jupyterlab
Jupyterlab and terminal
Change virtual environment
Install venv
:
sudo apt-get install python3-venv
Create environment:
python3 -m venv myenv --system-site-packages
Activate it:
source myenv/bin/activate
Note that the --system-site-packages
flag allows the python packages we installed by default to remain accessible in the virtual environment. It’s best to use this flag if you’re doing this on AI Platform Notebooks so that you keep all the pre-baked goodness.
Install jupyterlab:
pip install jupyterlab
Register this env with jupyter lab. It’ll now show up in the launcher & kernels list once you refresh the page.
python -m ipykernel install --user --name=myenv
Shutting down Jupyterlab via the terminal
user@PC:~/dev/tenv$ bg
[1]+ jupyter lab &
user@PC:~/dev/tenv$ ps
PID TTY TIME CMD
11 tty1 00:00:00 bash
2918 tty1 00:00:06 jupyter-lab
3210 tty1 00:00:00 ps
user@PC:~/dev/tenv$ kill 2918
user@PC:~/dev/tenv$ [C 2021-10-16 10:32:39.960 ServerApp] received signal 15, stopping
[I 2021-10-16 10:32:39.964 ServerApp] Shutting down 1 extension
[I 2021-10-16 10:32:39.964 ServerApp] Shutting down 0 kernels
[I 2021-10-16 10:32:39.965 ServerApp] Shutting down 0 terminals
[1]+ Done jupyter lab
user@PC:~/dev/tenv$ ps
PID TTY TIME CMD
11 tty1 00:00:00 bash
3211 tty1 00:00:00 ps
user@PC:~/dev/tenv$
Install in cell
%pip install -U scikit-learn
Sources: