Launch the IPython notebook server

By using IPython notebook, you can operate as a web application and use the IPython interactive environment only with a browser.

All you have to do is start IPython on the server side, so there are some benefits.

This area is as described in How to use IPython Notebook.

The IPython notebook will immediately display the plotted image as shown in the image below. Therefore, it is suitable for tasks such as exploratory data analysis.

3.png

Prepare a server for IPython notebook

It is assumed that Prepare a programming language environment for data analysis has been completed on the server side in advance.

Generate a profile for the server

First, issue the following command. This will generate a profile called nbserver in the .ipython directory of your home directory, in addition to the default.

ipython profile create nbserver

We will customize this as a profile for the server. The profile is generated under the ~ / .ipython / profile_ [profile name] / directory. You will be editing the configuration file here.

First of all, it is a good idea to write the following settings in ipython_notebook_config.py.

c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '*' #Make it accessible from other than localhost
c.NotebookApp.open_browser = False #Prevent the browser from opening automatically
c.NotebookApp.port = 9999 #Specify the server port

Start the IPython notebook server

Start the IPython notebook server as follows:

ipython notebook --pylab inline --profile=nbserver &

Accessing the address and port number specified in the server's configuration file with a browser opens the IPython notebook screen.

2.png

Set the initialization script

Using IPython's rich features I created the default initialization script for IPython. Since the profile is different, put the initialization script in ~ / .ipython / profile_nbserver / startup /. But basically the same initialization script is fine. Simply copy and add the necessary settings as appropriate.

Set a password to restrict access

You can use IPython notebook from anywhere as it is, but you may want to restrict access in many cases. Therefore, let's set a password for the time being.

From the new note in the IPython notebook, type the code as follows:

from IPython.lib import passwd
passwd()

Then, a password prompt will be displayed on the server-side terminal. Enter the desired new password here. The result is displayed in the browser with sha1 encryption.

All you have to do is write the above encrypted password hash in your config file.

c.NotebookApp.password = u'sha1:yourhashedpassword'

After that, when you restart the IPython notebook, the password input screen will be displayed as shown below.

1.png

Summary

With IPython notebook, you can use IPython in your browser from anywhere. However, if you use magic commands, you can issue commands to the OS, and the above password protection is not strong, so it is dangerous to open the server carelessly on the Internet. Don't forget that too.

Recommended Posts

Launch the IPython notebook server
Launch and use IPython notebook on the network
ipython notebook installation
IPython Notebook Recommendations
Launch an HTTP server in the current directory
Remotely open Jupyter notebook launched on the server
Remotely connect IPython notebook
How to instantly launch Jupyter Notebook from the terminal
[IPython] How to Share IPython Notebook
Parallel computing with iPython notebook
Launch a simple WEB server that can check the header
Displaying strings on IPython Notebook
How to use IPython Notebook
Try the Taxii server (1. Server settings)
Play with Jupyter Notebook (IPython Notebook)
Launch local server on mac
Run Apache-Spark with IPython Notebook
Run IPython Notebook on Docker
I tried to launch ipython cluster to the minimum on AWS
Graph drawing with IPython Notebook
Use Bokeh with IPython Notebook
Make the default interactive shell IPython
Simply view the Jupyter notebook file
Master the rich features of IPython
Build IPython Notebook environment with boot2docker
Launch jupyter notebook (+ take security measures)
Mastering the rich features of IPython (2)
Batch processing notes in IPython Notebook
Try the Taxii server (3.gunicorn settings)
The story of remounting the application server
Notes on using matplotlib on the server
Restart the server during Fabric processing
Settings that allow IPython Notebook to be accessed from outside the local