[PYTHON] Can you study with a minimum of belongings? Developed on iPad << 3rd >> ~ Savior Appears ~

review

Purpose

――Study with only the minimum items on your desk! !! ――How far can you study development with iPad Pro?

For people like this

--People who want to do anything with just one iPad --People who want to reduce what they carry --People who don't want to buy a new PC anymore --People who want to develop new ways of studying

environment

Why the update was delayed

it's simple. Because everything went wrong (tsu ω-`) But don't worry. A savior has appeared on the iPad.

What is a savior

iPad OS! !! Furthermore, ... ** Safari is now displayed on the PC version **.

What's so good

I'm wondering what's so good, Until now, use via a web browser I'm having trouble working with ** Cloud9 ** or ** Jupyter Notebook **, but this has been improved! (I had a hard time because the cursor operation on the Smart Keyboard didn't work ...) So, this time I would like to display Jupyter Notebook.

procedure

Launch VPS

Enter Sakura's VPS control panel and press "Start"

Enter the server using an SSH client

** Current Recommendations: Termius ** It was easy to do when using SSH connection with key authentication for security.

Get an image of Jupyter

Make sure you have Docker

$ docker --version
Docker version 1.13.1, build b2f74b2/1.13.1

Download image

docker pull jupyter/datascience-notebook

Create a password

Temporary start to make a hash (--rm is added so it disappears when it comes out of the container)

$ docker run -it --rm  jupyter/datascience-notebook /bin/bash

If you put it in a container like jovyan @ xxxxxxx, Borrow Python3 in the container and create a hash of the password (this time test, change it to your favorite and secure one)

$ python3 -c 'from notebook.auth import passwd;print(passwd())'
Enter password: 
Verify password: 
sha1:43dd030f7f29:bfa2d32e343582447c4ddf176911a8417bc64cc0 ← Use this later

Exit the container (Control + D is also possible)

$ exit

Start-up!

Use the hash created earlier for the password

A brief description of the arguments -d: I'll run it in the background --name: The container name is jupyter -p: If port 8888 is accessed from the outside, it means that you are connected to 8888 inside the container. -u: Use as root user

$ docker run -d --name jupyter -p 8888:8888 -u root jupyter/datascience-notebook start-notebook.sh --NotebookApp.password='sha1:43dd030f7f29:bfa2d32e343582447c4ddf176911a8417bc64cc0'

Confirmation that it is working

$ docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                    NAMES
5f9c6b139eae        jupyter/datascience-notebook   "tini -g -- start-..."   3 seconds ago       Up 2 seconds        0.0.0.0:8888->8888/tcp   jupyter

Access from a throbbing browser

When accessing with the IP address of my server: 8888. .. .. .. It's done (No ∀ \ *) A5773342-7B6E-4345-A88F-671C73545C05.jpeg Enter the password test. .. .. .. I put it in! 2DBEB3DB-6BF2-4861-8301-C8267EBC49AE.jpeg

Check if you can use Python If you select "Python 3" from "New" as indicated by the arrow above C33B7395-523F-4359-AC86-742EF21EF398.jpeg

Behave as you expected! !! !! The best! !!

Supplement) If you did not enter with xxx.xxx.xxx.xxx:8888

The port may not have been released.

First check the firewall settings

$ sudo firewall-cmd --list-all
[sudo] password for rgoto: 
public (active)
~Excerpt~
  ports: 8080/tcp 8888/tcp

It is rejected without 8888 / tcp here. Let's add it. (You can choose your favorite port with docker run port forwarding, so I think it is safer to use something that is not guessed.)

$ sudo firewall-cmd --add-port=8888/tcp --permanent

(If you forget / tcp, you will not be able to add it and you will be impatient)

Summary

I think I can finally use it properly! A boy on an iPad commercial 「What's a computer?」 I will try and error so that I can do something like that.

reference

Using Jupyter Notebook with Docker Open the CentOS 7 port with Sakura's VPS

Recommended Posts

Can you study with a minimum of belongings? Developed on iPad << 3rd >> ~ Savior Appears ~
Can you challenge Kaggle with just your iPad?
You can easily create a GUI with Python
A Study on Visualization of the Scope of Prediction Models
With GitPod, you can use both IDE and jupyter on your iPad, so it's great!
You can try it with copy! Let's draw a cool network diagram with networkx of Python