Jupyter Notebook on Raspberry Pi

Introduction: Jupyter Notebook on Raspberry Pi

About: I am a keen IoT inventor as a hobbyist in Sydney and very passionate about IoT and Algorithms such as MACHINE LEARNING, COMPUTATIONAL STATISTICS and so on. Also, I have spent almost every day of the past 15 ye…

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

4 People Made This Project!

Recommendations

  • Pi Day Speed Challenge

    Pi Day Speed Challenge
  • Trash to Treasure Contest

    Trash to Treasure Contest
  • Microcontroller Contest

    Microcontroller Contest

21 Comments

0
NatUwU
NatUwU

Question 2 months 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 ?

2021-01-05-183652_1920x1080_scrot.png
1
raspgraph
raspgraph

Tip 2 months 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.

0
NatUwU
NatUwU

Reply 2 months ago

WoW thank you !!

0
NatUwU
NatUwU

Question 2 months 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 !

0
laurenslowik
laurenslowik

7 months 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?

0
laurenslowik
laurenslowik

Reply 7 months 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!

2
GUIHAUMEY
GUIHAUMEY

Tip 1 year ago

jupyter notebook --ip 0.0.0.0 # allow remote access

0
Carlos AndresZ
Carlos AndresZ

Reply 11 months 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 :)

0
Carlos AndresZ
Carlos AndresZ

Reply 11 months 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...

0
GUIHAUMEY
GUIHAUMEY

Tip 1 year ago

pip install --upgrade ipython # fix prompt_toolkit issue

0
Narendral3
Narendral3

Reply 11 months 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?

0
GUIHAUMEY
GUIHAUMEY

Tip 1 year ago

jupyter notebook password # define password

0
urowietu
urowietu

1 year 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.

0
FranciscoB32
FranciscoB32

Question 2 years ago

I'd like to install numpy. How should I proceed? Thank you.

0
paulolange
paulolange

Answer 2 years ago

pip install numpy

0
wei彥
wei彥

2 years ago

How to set if you want to use putty under windown

I used the previous IPyter method but the settings look different.

0
JorgeA236
JorgeA236

Question 3 years ago

hi,
I try to run yolo in realtime on my laptop, macbook mid 2012 coreI5, but is very slow, the fps and recognition, any 5 second change the image, and i saw some people run yolo on devices like you, raspberry pi, the cpu is very low than my cpu, how do this posible.