Introduction: Jupyter Notebook on Raspberry Pi
About Jupyter Notebook
The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.
Step 1: Installation
Type the following into the terminal:
sudo su - apt-get update apt-get install python3-matplotlib apt-get install python3-scipy pip3 install --upgrade pip reboot sudo pip3 install jupyter
The Raspberry Pi normally uses an memory card, called an SD card, just like the ones you might use in your digital camera. They don’t have as much space as a normal computer. Issue the following command to clean up the software packages that were downloaded in order to update your Raspberry Pi.
sudo apt-get clean
Recent versions of Raspian replaced the Epiphany web browser with Chromium (an open source version of the popular Chrome browser). Epiphany is much lighter than the heavier Chromium and works better with the tiny Raspberry Pi Zero. To set it as the default browser to be used later for the IPython notebooks issue the following command:
sudo update-alternatives --config x-www-browser sudo reboot
Step 2: Testing
Start IPython by issuing the following command from the Terminal:
jupyter-notebook
23 Comments
Question 7 months ago
Nothing opens in chromium when i type "jupyter notebook". Anyone know how to fix it?
1 year ago
Thank you!!!
Question 2 years ago
Thank you to raspgraph for the awnser but now after I type the command to change default browser and reboot, epiphany is selectionned on manual like on the image (last line) and when I type "jupyter-notebook"that open chromium ! Somebody know how change that ?
Tip 2 years ago on Step 2
Hi
Good description, but..
#### ON a fresh copy of Raspberry Pi Os
[ https://www.raspberrypi.org/software/operating-sys... ]
#### I had to add a few things in to the terminal commands
sudo su -
apt-get update
apt-get install python3-matplotlib
apt-get install python3-scipy
pip3 install --upgrade pip
reboot
sudo pip3 install jupyter
#### always get errors at this point so to overcome them did the following
sudo apt update
sudo apt upgrade
sudo pip3 install jupyter --upgrade
#### now repeated installation .. much faster and error free
sudo pip3 install jupyter
sudo apt-get clean
Then it ran error free.
Reply 2 years ago
WoW thank you !!
Question 2 years ago
Hi! During the installation of jupyter this appear in red :
nbclient 0.5.1 has requirement jupyter-client>=6.1.5, but you'll have jupyter-client 5.2.3 which is incompatible.
notebook 6.1.6 has requirement jupyter-client>=5.3.4, but you'll have jupyter-client 5.2.3 which is incompatible.
notebook 6.1.6 has requirement jupyter-core>=4.6.1, but you'll have jupyter-core 4.4.0 which is incompatible.
then when I tried jupyter-notebook this error appeard :
Traceback (most recent call last):
File "/home/pi/.local/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/home/pi/.local/lib/python3.7/site-packages/notebook/notebookapp.py", line 81, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "/home/pi/.local/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "/home/pi/.local/lib/python3.7/site-packages/jupyter_client/__init__.py", line 4, in <module>
from .connect import *
File "/home/pi/.local/lib/python3.7/site-packages/jupyter_client/connect.py", line 32, in <module>
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
ImportError: cannot import name 'secure_write' from 'jupyter_core.paths' (/usr/lib/python3/dist-packages/jupyter_core/paths.py)
Thank you in advance !
3 years ago on Step 2
everything went off without a hitch but when I tried to update to Epiphany it was not listed as an option. anything I can do to address that?
Reply 3 years ago
lol nm, quick google got an install. however despite changing to epiphany as default jupyter notebook still launches in chromium. any tips to fix would be helpful. thanks!
Tip 3 years ago
jupyter notebook --ip 0.0.0.0 # allow remote access
Reply 3 years ago
this is what I was looking for, thank you so much.
BTW is there any way for this service to be executed at startup so I don't have to SSH each time to enable this?
Thanks in advance for your answer :)
Reply 3 years ago
I got it running after searching a lot!, you must run:
crontab -e
if if's your first time using it, you have to choose which text editor to use (I used nano, so the rest of the instructions are using nano)
and add the following line (this worked for me in my raspberry pi zero)
@reboot sudo -u pi jupyter notebook --ip 0.0.0.0 --no-browser &
press Ctrl + x then press y and then press enter to save changes
this will run the notebook on the background after every boot!
I hope this helps someone...
Tip 3 years ago
pip install --upgrade ipython # fix prompt_toolkit issue
Reply 3 years ago
Thanks a lot! Jupyter could not connect to the kernel without this upgrade.
However now Jupyter does not execute anything. Doesn't even print 'Hello word' Nothing happens after I run any code. What wrong am I doing?
Tip 3 years ago
jupyter notebook password # define password
3 years ago
This is awesome. I'm a big fan of SBC like raspberrypi and Odroid XU4 because they allow kids (and grownups like too) to tinker without breaking a $$$ computer. I've created a docker image for armv7l devices like the RPi3 and XU4 in case anyone is interested of a quick install. https://hub.docker.com/r/andresvidal/jupyter-armv7l and in github https://github.com/andresvidal/jupyter-armv7l. Enjoy!
4 years ago on Introduction
Fantastic.
I had been mucking about for ages and this sorted it right out. Now I can properly code on the move.
Beauty.
4 years ago on Introduction
The best tutorial!!! Works perfectly
Question 5 years ago
I'd like to install numpy. How should I proceed? Thank you.
Answer 4 years ago
pip install numpy
4 years ago
How to set if you want to use putty under windown
I used the previous IPyter method but the settings look different.