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.
It is assumed that Prepare a programming language environment for data analysis has been completed on the server side in advance.
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 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.
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.
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.
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