Skip to content

Commit 416c589

Browse files
committed
Update kernel installation
1 parent 8dc56c8 commit 416c589

File tree

2 files changed

+479
-2
lines changed

2 files changed

+479
-2
lines changed

examples/Notebook/Multiple Languages, Frontends.ipynb

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,105 @@
9696
"about the notebook document: it just gets sent cells of code to execute when the\n",
9797
"user runs them."
9898
]
99+
},
100+
{
101+
"cell_type": "markdown",
102+
"metadata": {},
103+
"source": [
104+
"## Install more languages\n",
105+
"\n",
106+
"The exact procedure to install a kernel for a different language will depend on the specificity of each language. \n",
107+
"Though ther is a common set of step to follow.\n",
108+
"\n",
109+
" - Install the language stack you are interested in.\n",
110+
" - Install the kernel for this language (often using given language package manager).\n",
111+
" - Register the kernel globally with Jupyter. \n",
112+
" \n",
113+
"While usually a kernel is though as a specific language, a kernel may be:\n",
114+
"\n",
115+
" - A virtual environment (or equivalent)\n",
116+
" - A set of configuration/environment variables.\n",
117+
" - A physical location (for remote kernels)\n",
118+
" \n",
119+
"Installing multiple kernels does not automatically allow one notebook to use many languages at once, but this is also possible.\n",
120+
"\n",
121+
"A community maintained list of available kernel can be found on the [Jupyter Wiki](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). "
122+
]
123+
},
124+
{
125+
"cell_type": "markdown",
126+
"metadata": {},
127+
"source": [
128+
"### Install a second python kernel\n",
129+
"\n",
130+
"\n",
131+
"Using conda:\n",
132+
"\n",
133+
"\n",
134+
"```\n",
135+
"$ conda create -n pycon-env python=3.6 --yes --quiet\n",
136+
"$ source activate pycon-env\n",
137+
"(pycon-env)$ conda install ipykernel --yes\n",
138+
"(pycon-env)$ python -m ipykernel install --name pycon-kernel\n",
139+
"Installed kernelspec pycon-kernel in /usr/local/share/jupyter/kernels/pycon-kernel\n",
140+
"```\n",
141+
"\n",
142+
"Available options are `--user`, `--name <machine-readable-name>`, `--display-name <\"User Friendly Name\">`"
143+
]
144+
},
145+
{
146+
"cell_type": "markdown",
147+
"metadata": {},
148+
"source": [
149+
"### Install and R kernel\n",
150+
"\n",
151+
"\n",
152+
"Again using conda, let's install the R stack and create an R kernel.\n",
153+
"\n",
154+
"In a shell:\n",
155+
"```\n",
156+
"$ conda install -c r r # install r form teh R channel\n",
157+
"$ conda install -c r r-irkernel\n",
158+
"$ r\n",
159+
"> IRkernel::installspec()\n",
160+
"```\n",
161+
"\n",
162+
"If you are not using conda you may need to replace by :\n",
163+
"\n",
164+
"```\n",
165+
"$ R\n",
166+
"> install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))\n",
167+
"...\n",
168+
"> devtools::install_github('IRkernel/IRkernel')\n",
169+
"```\n",
170+
"\n",
171+
"You may want to install Rin the **same** environment as the previous Python Kernel if you wish to do R **and** python inthe same notebook. "
172+
]
173+
},
174+
{
175+
"cell_type": "markdown",
176+
"metadata": {},
177+
"source": [
178+
"### install more kernels\n",
179+
"\n",
180+
"Feel fre to experiment with other kernel, poke at the installed kernelspec folders. Use the following to list all the kernels and their locations:\n",
181+
"\n",
182+
"```\n",
183+
"$ jupyter kernelspec list\n",
184+
"Available kernels:\n",
185+
" ir /home/jovyan/.local/share/jupyter/kernels/ir\n",
186+
" julia-0.5 /opt/conda/share/jupyter/kernels/julia-0.5\n",
187+
" python3 /opt/conda/share/jupyter/kernels/python3\n",
188+
" python2 /usr/local/share/jupyter/kernels/python2\n",
189+
"```"
190+
]
191+
},
192+
{
193+
"cell_type": "markdown",
194+
"metadata": {},
195+
"source": [
196+
"The above process can take a long time, need to compile a few modules. You may want to try the `jupyter/datascience-notebook` Docker image which already have Python, Julia and R installed. Warning the Docker image is big (several GB) ! Please don't try to download it on Conference wifi. "
197+
]
99198
}
100199
],
101200
"metadata": {
@@ -114,9 +213,9 @@
114213
"name": "python",
115214
"nbconvert_exporter": "python",
116215
"pygments_lexer": "ipython3",
117-
"version": "3.4.3"
216+
"version": "3.6.0"
118217
}
119218
},
120219
"nbformat": 4,
121-
"nbformat_minor": 0
220+
"nbformat_minor": 1
122221
}

0 commit comments

Comments
 (0)