Running Jupyter Notebooks on a Ubuntu Server

[yes|no]The final part of the installation will ask if you’d like to install VS Code.

Decline this offer because Microsoft sucks.

Finally, reload your /.

bashrc file to get apply Conda’s changes:$ source ~/.

bashrcSetting Up Conda EnvironmentsConda installations can be isolated to separate environments similarly to the way Pipenv might handle this.

Create and activate a Conda env:$ conda create –name myenv python=3$ source activate myenvCongrats, you’re now in an active Conda environment!Starting Up JupyterMake sure you’re in a directory you’d like to be running Jupyter in.

Entering jupyter notebook in this directory should result in the following:(jupyter_env) myuser@jupyter:~$ jupyter notebook[I 21:23:21.

198 NotebookApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret[I 21:23:21.

361 NotebookApp] Serving notebooks from local directory: /home/myuser/jupyter[I 21:23:21.

361 NotebookApp] The Jupyter Notebook is running at:[I 21:23:21.

361 NotebookApp] http://localhost:8888/?token=1fefa6ab49a498a3f37c959404f7baf16b9a2eda3eaa6d72[I 21:23:21.

361 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[W 21:23:21.

361 NotebookApp] No web browser found: could not locate runnable browser.

[C 21:23:21.

361 NotebookApp]Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=1u2grit856t5yjhThis next part is tricky.

To run our notebook, we need to reconnect to our VPS via an SSH tunnel.

Close the terminal and reconnect to your server with the following format:ssh -L 8888:localhost:8888 myuser@your_server_ipIndeed, localhost is intended to stay the same, but your_server_ip is to be replaced with the address of your server.

With that done, let’s try this one more time.

Remember to reactivate your Conda environment first!(jupyter_env) myuser@jupyter:~$ jupyter notebookThis time around, the links which appear in the terminal should work!WE DID ITBONUS ROUND: Theme Your NotebooksIf ugly interfaces bother you as much as they bother me, I highly recommend taking a look at the jupyter-themes package on Github.

This package allows you to customize the look and feel of your notebook, either as simple as activating a style, or as complex as setting your margin width.

I highly recommend checking out the available themes to spice up your notebook!Originally published at hackersandslackers.

com on March 2, 2019.

.. More details

Leave a Reply