Click here to Skip to main content
15,892,005 members
Articles / Programming Languages / Python
Tip/Trick

Easily to build an IPython + Notebook environment for Science Computation in Cloud (with detailed steps)

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
7 Mar 2015CPOL5 min read 13.7K   2  
This article will teach users how to create a dedicated IPython + Notebook environment on cloud (SuperVessel cloud), in the most easy and free way. Users could try it at once !!

Brief

IPython + Notebook provides a way to do the sciense computation in cloud. The advantage includes

  • Science computation could leverage the parral computing capability on cloud, to get much better performance than your laptop.
  • No software will be reqired to be installed on your local laptop.
  • The required bandwidth from your home's laptop to cloud will be very low, and affordable for good user experience.

Required preparation

No special requirement !!! Only to ensure you have your IE, or Chrome, or Firefox installed.

Start Step by Step......

To register a cloud account

Here we suggest you to use SuperVessel Cloud (Registration at: http://www.ptopenlab.com. Two reasons:

  1. SuperVessel Cloud is built for developers, and to promote the OpenPOWER foundation. It is free for all developers in the world.
  2. SuperVessel Cloud has provided the free image supporting IPython + Notebook. It will be very convinent for users to apply and use.

It will be very easy to finish the registration (please ignore this section if you have got the account).

  1. Go to the website: http://www.ptopenlab.com
  2. Click the button of "Registration". Then input your email address and password. SuperVessel cloud will send a confirmation email to activate your account.

Image 1

To create a virtual machine with IPython + Notebook support

1. Click the "Start Service" button on the www.ptopenlab.com home page, then you will go into your SuperVessel Cloud Management Dashboard. You will need to logon again with the email address and password (used in your registration).

2. After login, you will see the dashboard. Then click the "Pre-installed compute service".

Image 2

Then you will see the list of pre-installed compute service images.

Image 3

3. Select the image "Python Science COmputing and Application Development", and click "Launch".

Image 4

4. The new instance will be listed in your Instances table. And there will be an email (sent by admin@ptopenlab.com) being sent to you and inform you all the user name and password information of this new instance. You will need the user name and password to SSH onto this VM in next step.

If it is your first time to apply resource on SuperVessel, the system will assign you a VPN account automatically.  About how to config the VPN on your laptop, please refer to the link: https://services.ptopenlab.com/mediawiki/index.php/VPN%E7%9A%84%E4%BD%BF%E7%94%A8/en.  It records very detailed steps.

Log on and config the IPython + Notebook environment

We need to log onto the new cloud instance and config the development environment.

1. To log onto the cloud instance, we need to connect with VPN. Please refer to the link https://services.ptopenlab.com/mediawiki/index.php/VPN%E7%9A%84%E4%BD%BF%E7%94%A8/en. for detailed steps.

2. After VPN connection, you could use SSH to connect the virtual machine of the IPython + Notebook. In Windows, you could use the tool like putty. In Linux, you could use SSH command directly. As default, you will use "opuser" as the user name to SSH onto the virtual machine. The password will be sent to you via the email.

3. Switch to "root" account. After log onto the virtual machine, you could use "su" to switch to "root".

opuser@gto:/home/opuser# su

The original password of "root" is "passw0rd". But you will be forced to change the password at your first logon.

4. Open the service port for Notebook. In this environment, the GUI will be provided via Web-Server way with the default service port 9999. So you need to open the service port of this virtual machine in your dashboard. The URL to open the service port is https://crl.ptopenlab.com:8800/dashboard/project/access_and_security/

As default, all the VMs in SuperVessel cloud will only have port 22 open (for SSH). You could follow the configuration in this figure to add the service port 9999.

Image 5

For any more questions about how to open the service port, you could also refer to the link:

https://services.ptopenlab.com/mediawiki/index.php/%E6%8E%A7%E5%88%B6%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%8F%A3%E8%AE%BF%E9%97%AE/en

5. Launch the IPython Notebook service. Under the root account, please input the following command to start the remote science computation development service:

 root@gto:~/# ipython notebook --profile=nbserver

If the service could be launched successfully, you could get the output in command line similar to following.

2014-12-21 18:11:35.339 [NotebookApp] Using existing profile dir: u'/root/.ipython/profile_nbserver'
     2014-12-21 18:11:35.344 [NotebookApp] Using system MathJax
     2014-12-21 18:11:35.351 [NotebookApp] Serving notebooks from local directory: /root/src
     2014-12-21 18:11:35.351 [NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:9999/
     2014-12-21 18:11:35.351 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
     ^C2014-12-21 18:11:41.925 [NotebookApp] interrupted
     Serving notebooks from local directory: /root/src
     The IPython Notebook is running at: https://[all ip addresses on your system]:9999/

Access the development GUI in local browser

Input the following URL in the browser of your laptop.

https://172.16.10.35:9999/

Here, the 172.16.10.35 should be replaced by your VM IP address. Because we use SSL to encrypt all the communication between your browser and server, you have to use "https". That's why you will get the warning from your browser. You could directly accept it. For example, you will get the following warning in IE.

Image 6

You could just accept the exception. Then you will see the first Notebook page.

Image 7

In this environment, we set the default password of IPython Notebook server as "passw0rd". You could use it to log in.

Develop the your first IPython sciense compute program remotely

Now, you could click “New Notebook”. In the new page, you could input the following simple code lines.

a = rand(100)
plot(a)

They are very simple. First, we define the array a with 100 randomized digits. Then we use plot to generate the curve for array a. Here is how the GUI looks like.

Image 8

It is very easy, right?

Change the default password of IPython Notebook

If you want to change the default password, you could following these steps to change it.

1. With root account, you could input following command to generate the new password.

python -c "import IPython;print IPython.lib.passwd()"

2.  System will generate the SHA code for your new password.

     Enter password:
     Verify password:
     sha1:a83146285fe2:5288dfeb3a6a88cf46028af16992fadce...

3. Open and edit the configuration file

vim /root/.ipython/profile_nbserver/ipython_notebook_config.py

4. To modify the password setting:

 c.NotebookApp.password = u'sha1:a83146285fe2:5288dfeb3a6a88cf46028af16992fadce...'

5. Restart the service:

     ipython notebook --profile=nbserver

Done!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
China China
SuperVessel cloud (www.ptopenlab.com) is the cloud platform built on top of POWER/OpenPOWER architecture technologies with OpenStack. It aims to provide the free virtual resources for all the developers and university students in the world. We are calling for users now!! Any users could freely register and apply the virtual machines, dockers and big data clusters on SuperVessel now.
This is a Social Group

1 members

Comments and Discussions

 
-- There are no messages in this forum --