[PYTHON] Easy Jupyter environment construction with Cloud9

** Super easy setting **

I made a super easy version. https://github.com/y-sama/cloud9 Mainly, Jupyter, Pandas, Scikit-learn, tensorflow can be used.

git clone https://github.com/y-sama/cloud9.git
bash cloud9/init.sh

Introduction

Recently, I heard that you can put Jupyter on the online IDE Cloud9 somewhere. There is a preceding article, but I will reorganize it for myself.

I think it takes less than 10 minutes for the fastest setting to ignore security, and less than 30 minutes for various settings. The free DISK that can be used with Cloud9 is 2GB, but I use about 1.6GB. Unfortunately, Tensorflow cannot be installed because it consumes disk space. Also, since it is a single core, I can not do serious calculations, but if you are interested in Jupyter, want to try pandas, or want to do a scikit-learn tutorial, it is enough.

Create a Cloud9 account

All you need is your email address. https://c9.io/signup

All you have to do is enter your name.

So far ** 1 minute **

Create workspace

Create a suitable workspace. For the time being, the Private setting and Template are set to python, but anything is fine. It takes a while for the virtual machine to start up.

So far ** three minutes **

Fastest setting

When the workspace screen comes up, there is a bash console at the bottom of the screen, so copy and paste the following Script.

git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc
pyenv install anaconda3-4.0.0
pyenv rehash
pyenv global anaconda3-4.0.0

Anaconda will be downloaded, but it will take about 3 minutes.

Up to here ** 6 minutes **

Start Jupyter

jupyter notebook --ip 0.0.0.0 --port 8080 --no-browser

Security is super sweet, but for the time being, it works.

https://<workspace>.<username>.c9users.io

You can access Jupyter from. Since it is https, be careful only there.

Up to here ** 7 minutes ** At the fastest, you can prepare the environment in less than 10 minutes: laughing:

Anaconda settings

If you have miniconda instead of Anaconda, you can probably add this much.

conda install jupyter scikit-learn bokeh seaborn pandas dask networkx numba pep8 pillow scikit-image sqlalchemy sqlite statsmodels sympy xlrd xlsxwriter xlwt

You should set this much around Anaconda.

conda update conda #The version of conda goes up often, so check it for the time being
echo 'alias activate="source $PYENV_ROOT/versions/anaconda3-4.0.0/bin/activate"' >> ~/.bashrc
source ~/.bashrc
conda install seaborn #It's not in anaconda so I'll put it in

Jupyter settings

** Cloud9 can be accessed from anywhere, so it is better to set a password. ** **

Reference

--Create a config file --Generate a hash string for the password when accessing Jupyter.

mkdir ~/workspace/jupyter
jupyter notebook --generate-config
#>>> Writing default config to: /home/ubuntu/.jupyter/jupyter_notebook_config.py
python -c "from notebook.auth import passwd;print(passwd())" 
#>>> Enter password: #Enter the password to use when accessing Jupyter
#>>> Verify password: 
#>>> 'sha1:......' #Copy after sha

--Edit jupyter_notebook_config.py.

vi ~/.jupyter/jupyter_notebook_config.py

Edited part of jupyter_notebook_config.py

changes initial value After change
c.NotebookApp.ip 'localhost' '*'
c.NotebookApp.notebook_dir null '/home/ubuntu/workspace/jupyter'
c.NotebookApp.open_browser True False
c.NotebookApp.port 8888 8080
c.NotebookApp.password null 'sha1:......' #The hash string from earlier

This is also weak in terms of security, so if you want to keep Jupyter running all the time, limit your IP address.

startup settings

If you place .py or .ipy in ~ / .ipython / profile_default / startup, it will be loaded when Ipython kernel starts. If you put a file like 00_start.ipy, it's easy because you don't have to type it each time you start Jupyter. The .ipy format can also write ipython magic commands.

00_start.ipy


import os,sys
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline

Installation of extension

Assorted IPython extensions, extension RISE for presentation, document search jupyter_cms in Jupyter are included.

cd ~/
git clone https://github.com/ipython-contrib/IPython-notebook-extensions
cd IPython-notebook-extensions
python setup.py install
cd ../
git clone https://github.com/damianavila/RISE
cd RISE
python setup.py install
pip install jupyter_cms
jupyter cms quick-setup --sys-prefix

[Qiita article] of IPython-notebook-extensions (http://qiita.com/sasaki77/items/30a19d2be7d94116b237) Drag & Drop is convenient.

Start-up

jupyter notebook

If you save the file with jupyter.sh and run it once, it will be easier because you can start it with one last run from the next time onwards.

Put it in Jupyter with https: // <workspace>. <Username> .c9users.io.

It's the best toy.

Recommended Posts

Easy Jupyter environment construction with Cloud9
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Easy tox environment with Jenkins
ML environment construction with Miniconda
Switch virtual environment with jupyter
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
From Kafka to KSQL --Easy environment construction with docker
Get started with Python! ~ ① Environment construction ~
ruby environment construction with aws EC2
[MEMO] [Development environment construction] Jupyter Notebook
Automate environment construction with Shell Script
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Using Chainer with CentOS7 [Environment construction]
pytorch @ python3.8 environment construction with pipenv
Data science environment construction with Docker
Easy deployment environment with gaffer + fabric
Environment construction with pyenv and pyenv-virtualenv
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Build Jupyter Lab (Python) environment with Docker
Vue.js + Flask environment construction memorandum ~ with Anaconda3 ~
A memo packed with RADEX environment construction
Let's get along with Python # 0 (Environment construction)
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Environment construction (python)
django environment construction
CodeIgniter environment construction
[Cloud102] # 1 Let's get started with Python (Part 2 Jupyter Notebook Construction AWS Edition)
python environment construction
Python --Environment construction
Python environment construction
Golang environment construction
python environment construction
Word2vec environment construction
Collecting information from Twitter with Python (Environment construction)
Create the strongest calculator environment with Sympy + Jupyter
Try using conda virtual environment with Jupyter Notebook
Cloud9 environment construction for developing serverless web applications
[0] TensorFlow-GPU environment construction built with Anaconda on Ubuntu
Poetry-virtualenv environment construction with python of centos-sclo-rh ~ Notes
First python ① Environment construction with pythonbrew & Hello World !!
From Python environment construction to virtual environment construction with anaconda
Make your Python environment "easy" with VS Code
[Cloud102] # 1 Let's get started with Python (Part 3 Jupyter Notebook Construction GCP Cloud Shell Edition)
Python local development environment construction template [Flask / Django / Jupyter with Docker + VS Code]
Easy Python data analysis environment construction with Windows10 Pro x VS Code x Docker
R environment construction with Jupyter (formerly IPython notebook) (on OS X El Capitan 10.11.3)
Multiple selections with Jupyter
Easy Grad-CAM with pytorch-gradcam
Candlestick with plotly + Jupyter
Easy Machine Learning with AutoAI (Part 4) Jupyter Notebook Edition
Environment construction: GCP + Docker
Django project environment construction
python windows environment construction
ConoHa environment construction memo
PyData related environment construction
Python development environment construction
Data analysis environment construction with Python (IPython notebook + Pandas)
An easy way to create an import module with jupyter