INSTALL

anaconda

This is suggested for new and normal users to use a stable environment.
It is not suitable for the ones wanna try very new things.

for windows

Download Python 3 from Anaconda and install.
From Windows "Start" menu, run "Jupyter" directly. (at least since v5.3.1)
Old versions needs to run from navigator as below:

anaconda for linux

Similar to win, for details, see here.

ubuntu 16

sudo apt-get update && \
sudo apt-get -q install -y python3-pip && \
sudo pip3 install --upgrade pip ; sudo pip install --upgrade pip && \
sudo apt-get install -y python-dev python3-dev ipython ipython-notebook && \
sudo -H pip install jupyter; sudo -H pip3 install jupyter && \
sudo -H pip3 install scipy numpy scikit-learn matplotlib pandas sympy nose ggplot

Now, jupyter-notebook uses py3 by default.
To add py2 into jupyter menu:

# sudo pip2 install --upgrade pip && \
sudo apt-get -q install -y python-pip && \
sudo python2 -m pip install ipykernel && \
sudo python2 -m ipykernel install --user

(if py3 is lost later for some reason, do the following):

sudo pip3 install jupyter ipykernel
sudo python3 -m ipykernel install --user

ref: stackOverflow

win

When having py2, want py3 with jupyter:

pip3 install jupyter
jupyter-notebook.exe

REMOTE JUPYTER IN WEB

  1. setup ssh tunnel: ssh-in-case-of > SSH Tunneling > port forwarding (jupyter exmaple).
  2. run jupyter-notebook in server ssh, will see some errors regarding X11 / javascript, ignore them.
  3. local browser localhost:80.

WIN BUGS

Mac: not displaying ggplot erros ref
Win: not displaying ggplot deep erros (ggplot >> aex() contains non-existing column name, rstudio can display errors.) (gpu workday >> 860_paper_plot.ipynb)

SHORTCUT / KEYMAP

web (modified to: weidadeyue_jupyter-notebook-cheatsheet-shortcut.xlsx)
customize
totally vim binding (with nix cmd)
for win, run the following: (though output ok, seems not working)

jupyter --data-dir
mkdir -p C:\Users\<user_name>\AppData\Roaming\jupyter\nbextensions
cd C:\Users\<user_name>\AppData\Roaming\jupyter\nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
jupyter nbextension enable vim_binding\vim_binding

+ R (Original Way)

See also: install R.
WARN: MUST close other R sessions before installation to update necessary dependencies.
Step 1. install py 3. see: learning-python
Step 2. install jupyter pip3 install jupyter
Step 3. install r packages as below:
Firstly, some system dependencies:

sudo apt-get install -y libssl-dev libssh2-1-dev libcurl4-openssl-dev zlib1g-dev # Ubuntu only: is.gd/JLfcOQ

Then in R (by: sudo -i R)

# run cmd one by one
install.packages(c('devtools', 'digest', 'repr','devtools', 'digest', 'IRdisplay', 'crayon', 'pbdZMQ', 'devtools'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()  # to register the kernel in the current R installation

OBS: the last command should be done by each jupyter user in nix.
To install for more R installations, see IRkernel doc.
Step 4. run jupyter jupyter-notebook.exe

+ R (Anaconda Way)

Step 1. install anaconda3 (or miniconda) with py 3

  • install for only one user
  • do NOT add to system PATH (just keep default)

Step 2. install conda packages
conda install -c r ipython-notebook r-irkernel ipython notebook
Step 3. run
jupyter notebook
ref: Revolution Analytics .com

+ Julia

Step 1. install Julia
Step 2. install IJulia

.\julia.exe
Pkg.add("IJulia")
Pkg.build("IJulia")

Step 3. run

.\julia.exe
using IJulia
notebook()

or

jupyter notebook

official github ref

julia + conda (not suggested)

conda has no IJulia support yet,
to install julia only:
conda install -c wakari1 julia=0.3.0.git_prerelease
ref

spark

see spark

TIPS

module auto-reload

In ipython notebook (ipynb), put the following code before importing the packages the should be auto-reloaded:

%load_ext autoreload
%autoreload 2

cell display width

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:80% !important; }</style>")) # Set cell width equal to 'browser width'

pandas display

pd.options.display.max_rows = 6

toc

Table of Contents

nix

jupyter nbextension install --user https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/toc.js
curl -L https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/toc.css > $(jupyter --data-dir)/nbextensions/toc.css
jupyter nbextension enable toc

win

jupyter nbextension install --user https://rawgithub.com/minrk/ipython_extensions/master/nbextensions/toc.js

save this link as file: $(jupyter --data-dir)/nbextensions/toc.css

jupyter nbextension enable toc

OBS : CONDA

Conda is a cross-language package management system, its binary packages are in a different path, not the system's python / R. It installs frequently used packages by default.
See more "Conda vs Anaconda vs Miniconda" & "Conda vs pip" here: continuum.io