As mentioned in the introduction, Jupyter Notebooks have gained a lot of traction in the last couple of years. Notebooks are an intuitive tool for running blocks of code. When creating the Anaconda environment in the Installing Anaconda and Libraries recipe, we included Jupyter in our list of libraries to install.Â
Connecting with Jupyter Notebooks on a server
How to do it...
- If you haven't installed Jupyter yet, you can use the following command in your activated Anaconda environment on the server:
conda install jupyter
- Next, we move back to the terminal on our local machine.
- One option is to access the Jupyter Notebook running on a server using SSH-tunnelling. For example, when using Google Cloud Platform:
gcloud compute ssh --ssh-flag="-L 8888:localhost:8888" --zone "europe-west1-b" "instance-name"
You're now logged in to the server and port 8888 on your local machine will forward to the server with port 8888.
- Make sure to activate the correct Anaconda environment before proceeding (adjust the name of your environment accordingly):
source activate environment-deep-learning-cookbook
- You can create a dedicated directory for your Jupyter notebooks:
mkdir notebooks
cd notebooks
- You can now start the Jupyter environment as follows:
jupyter notebook
This will start Jupyter Notebook on your server. Next, you can go to your local browser and access the notebook with the link provided after starting the notebook, for example, http://localhost:8888/?token=1fa4e9aea99cd7be2b974557eee3d344ca3c992f5861834f.