How to run Jupyter Notebooks in Cloud
Hello all,
In this article, I explained on how to open and run Jupyter notebooks in Cloud/Server. As most of cloud machines prefer Ubuntu or other Linux operating systems, we may only be able to access virtual machine in cloud using command line interface (CLI). In that case, it would be a challenge to open Jupyter notebooks as we usually access it through a browser.
I would like to take an example of Azure VM for explaination but this would be valid for most of cloud platforms.
Login to VM
Use the following command to login to your VM thru sshssh username@ipaddressIn case if you dont have a VM, you can create one by logging onto Azure Portal and following the steps mentioned in this Azure VM Documentation
Using TMUX
Tmux is very useful tool which will allow to run multiple terminal sessions within terminal and also let the code running even though you closed the terminalUse tmux ls for list of open tmux sessions
Use tmux to create a new session
Use tmux attach to go to already opened sessionPlease refer the following website for more commands
https://tmuxcheatsheet.com/
Open Jupyter Notebook in VM
While accessing VM through command prompt, we don't have a browser to open Jupyter notebook. So, We have to open Jupyter in no browser mode using following commandjupyter notebook --no-browser --port 8888
http://localhost:8888/token=8s3hdig3d3gd37gdi8hdqdgqi7q3gd38d39h33
Port Forwarding to Local
As we cannot open a jupyter notebook in VM,we forward the hosted jupyter port to our local by using the following command in your local machine.ssh -N -f -L localhost:8888:localhost:8888 username@ipaddress
Access Jupyter Notebook in Local
Now, Open one more command prompt window in your local machine where we can open the jupyter notebook by entering the url which is generated while opening the jupyter notebook in VM. For example, something like thisPlease stay tuned for more interesting and useful articles. Also Subscribe to our Youtube channel for Video Tutorials in Python, Machine Learning and many others
Comments
Post a Comment