Jupyter will be greatly improved in UI and functions as ** Jupyter Lab ** from the next version. Here, I will back the leaflet for myself how to build the Jupyter Lab environment on AWS EC2 and how to use it easily. Aside from the detailed settings, the goal is to quickly build a Jupyter Lab environment on EC2 and try out how it has evolved.
Jupyter Lab is still a preview version, please refer to Jupyter Lab Github for the latest information. Also, for the environment construction method of the old Jupyter Notebook, please refer to Click here.
For the background and function introduction of Jupyter Lab development, see Jupyter Lab introduction video and [Explanation Slide](http: /) at SciPy 2016. /archive.ipython.org/media/SciPy2016JupyterLab.pdf) is easy to understand, but the following two materials are the key points.
This is the procedure to build a Jupyter Lab environment on AWS EC2. It is almost the same as the environment construction method of the old Jupyter Notebook.
Start EC2 that runs Jupyter and log in with ssh.
8080
in the EC2 Security GroupʻAtp-get` to put the required module, update pip and install jupyterlab.
$ sudo apt-get update && sudo apt-get -y upgrade
$ sudo apt-get install -y python-pip libpq-dev python-dev
$ sudo pip install -U pip
$ sudo pip install jupyterlab widgetsnbextension
$ sudo jupyter serverextension enable --py jupyterlab --sys-prefix
If you want to write a Chart with Matplotlib, add the necessary modules such as numpy and matplotlib (but it will take a few minutes to install).
$ sudo apt-get install -y libpng12-dev libjpeg8-dev libfreetype6-dev libxft-dev
$ sudo pip install numpy pandas matplotlib seaborn scikit-learn
The following command will create a Jupyter configuration file template (~ / .jupyter / jupyter_notebook_config.py
).
$ jupyter notebook --generate-config
Then edit ~ / .jupyter / jupyter_notebook_config.py
. Since it is a big file that is all commented out, put the following 4 lines in any place you like, such as the beginning of the file, and save it.
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8080
Run the following command to start Jupyter.
$ jupyter lab
In this state, go to EC2 such as ʻec2-53-239-93-85.ap-northeast-1.compute.amazonaws.com:8080on the browser and succeed if the following Jupyter Lab initial screen appears. (Don't forget the port
8080`).
If you want to run Background, set nohup jupyter lab> / dev / null 2> & 1 &
and Jupyter will continue to work even if you disconnect ssh.
If you want to start Jupyter lab automatically, you can make it run jupyter lab
when AWS EC2 starts by following the steps below.
touch ~/start_jupyter.sh
start_jupyter.sh
and write / usr / local / bin / jupyter lab
in it.chmod 777 ~/start_jupyter.sh
/etc/rc.local
with root privileges and put a line of su --ubuntu /home/ubuntu/start_jupyter.sh &
before ʻexit 0`shutdown -r now
with root privilegesHave a good Jupyter life!
Recommended Posts