Hi all,
I have been at this a while now and Google has failed me...
My goal is to have a Jupiter notebook server running on the pi which I can just ssh into. Now I have installed Jupiter and it will run manually however, I wish to use rc.local or crontab to run it at boot so I can schedule a reboot at night and not have to start up the server each time I want to use it but I have had no joy.
These are my failed crontab attempts:
@reboot /usr/local/bin/jupyter notebook &
@reboot "/usr/local/bin/jupyter notebook" &
I have a raspberry pi 2 running Raspbian
Any help would be appreciated
Re: jupyter notebook (was ipython notbook)
Well that's annoying... a few mins after I post this I find an answer
I have added this to my /etc/rc.local file above exit 0:
(nohup /usr/local/bin/jupyter-notebook > /var/log/jupyter1-boot.log 2>&1) &
my error was missing out the - between jupyter and notebook. Solution found here: https://github.com/jupyter/notebook/issues/448
Hope this helps others as I think jupyter notebook rather a handy way to code on a headless pi.
I have added this to my /etc/rc.local file above exit 0:
(nohup /usr/local/bin/jupyter-notebook > /var/log/jupyter1-boot.log 2>&1) &
my error was missing out the - between jupyter and notebook. Solution found here: https://github.com/jupyter/notebook/issues/448
Hope this helps others as I think jupyter notebook rather a handy way to code on a headless pi.
Re: jupyter notebook (was ipython notbook)
Hi, I found your post when searching for ipython. Just wanted to ask.. if ipython through canopy (enthought) is supported for raspberry pi? The reason I ask is from what I understand the benefit of installing ipython through enthought/canopy is that it comes with many other libraries pre-packaged in a stable format. I haven't tried this myself yet but if you have some insight on this would love to hear your thoughts. Also, was curious if you installed any libraries for ipython/python on your own for raspeberry pi and if they worked ok. Last but not least, could you point me to some reading material or elaborate a little bit more on the 'headless' setup you have for ipython on pi and then I guess your main data files on your laptop/other machine? I'm just starting to explore raspberry pi and would love to learn more about your approach.
Thanks!
Thanks!
Re: jupyter notebook (was ipython notbook)
Hi Starly,
Unfortunately I have never used Enthought so don't have much to say on it. But I have a few tips on installing packages which might help you out and how I use Jupyter Notebook as part of my headless setup.
Installing Librarys:
I tend to follow the instructions form the library's reliant website for using pip to install it.
You can install pip using:
When installed this way it can be a slightly out of date version. To make sure it is the latest version of pip use:
Once it is updated to the latest version you can install librarys which should look something like this to install jupyter for example:
My headless method:
When I log in with ssh I tend to log in with certain ports automatically forwarded off the back of that connection so web-servers or databases ran locally on the raspberry pi can be seen by the computer I am using to access the Raspberry Pi. This allows me to run Jupiter Notebook on the Raspberry Pi and access the webpage it creates remotely.
Notebook is great as I make a lot of mistakes when coding. It has auto complete and allows you to run your code in blocks so you can test your code in segments to help you debug it and build it up gradually. It returns outputs such as print() and errors directly under the block you are running. The code you write with it is running on the pi itself so you know that when it works its working on the pi. Finally it is useful to download and upload files using the Jupyter Dashboard to and from your pi.
Tunneling:
Setting up the Local forwarding for the ports is different for Mac and Ubuntu vs Windows.
On a mac or Ubuntu:
I use the .ssh/config to create shortcuts, open a terminal:
sudo nano .ssh/config
Then you can copy in this and tweak for your settings:
ctrl + x then ctrl + y to save and exit.
Host - This is the nickname for the connection setting as you can have several in this file
Port - Is optional if using the default 22
HostName - Is the IP address in this case a local one but it can be a web address such as a duckdns.org a free dns service.
LocalForward - For simplicity just copy these and change 3306 to the port you want.
To connect to you pi just use ssh:
(or whatever you put after Host)
On Windows I use Putty:
Download from: http://www.chiark.greenend.org.uk/~sgta ... nload.html
I downloaded Putty.exe
There are plenty of guides on how to connect via putty so i will briefly mention the ports:
Click the +ssh tab on the left
Then tunnels
Use this window to configure your ports for example:
Source Port: 8888
Destination: 127.0.0.1:8888
Click add
Rinse and repeat for any other ports if necessary
At the top left click on session
Under saved sessions give it a nickname
Click Save
Click Open
Login as normal.
Using either of these methods will mean the machine you are login onto your pi with (Client) has those ports as if they were local. Once you have Jupiter notebook installed you can do the following:
Run jupyter notebook:
Go to a browser on the Client machine and enter into the url bar:
127.0.0.1:8888
You should then be presented with the Jupyter Dashboard.
Unfortunately I have never used Enthought so don't have much to say on it. But I have a few tips on installing packages which might help you out and how I use Jupyter Notebook as part of my headless setup.
Installing Librarys:
I tend to follow the instructions form the library's reliant website for using pip to install it.
You can install pip using:
Code: Select all
sudo apt-get update
Code: Select all
sudo apt-get install python-pip
Code: Select all
sudo pip install -U pip
Code: Select all
sudo pip install jupyter
When I log in with ssh I tend to log in with certain ports automatically forwarded off the back of that connection so web-servers or databases ran locally on the raspberry pi can be seen by the computer I am using to access the Raspberry Pi. This allows me to run Jupiter Notebook on the Raspberry Pi and access the webpage it creates remotely.
Notebook is great as I make a lot of mistakes when coding. It has auto complete and allows you to run your code in blocks so you can test your code in segments to help you debug it and build it up gradually. It returns outputs such as print() and errors directly under the block you are running. The code you write with it is running on the pi itself so you know that when it works its working on the pi. Finally it is useful to download and upload files using the Jupyter Dashboard to and from your pi.
Tunneling:
Setting up the Local forwarding for the ports is different for Mac and Ubuntu vs Windows.
On a mac or Ubuntu:
I use the .ssh/config to create shortcuts, open a terminal:
sudo nano .ssh/config
Then you can copy in this and tweak for your settings:
Code: Select all
Host Screen1
User pi
Port 22
HostName 192.168.1.15
LocalForward 8888 127.0.0.1:8888
LocalForward 3306 127.0.0.1:3306
Host - This is the nickname for the connection setting as you can have several in this file
Port - Is optional if using the default 22
HostName - Is the IP address in this case a local one but it can be a web address such as a duckdns.org a free dns service.
LocalForward - For simplicity just copy these and change 3306 to the port you want.
To connect to you pi just use ssh:
Code: Select all
ssh Screen1
On Windows I use Putty:
Download from: http://www.chiark.greenend.org.uk/~sgta ... nload.html
I downloaded Putty.exe
There are plenty of guides on how to connect via putty so i will briefly mention the ports:
Click the +ssh tab on the left
Then tunnels
Use this window to configure your ports for example:
Source Port: 8888
Destination: 127.0.0.1:8888
Click add
Rinse and repeat for any other ports if necessary
At the top left click on session
Under saved sessions give it a nickname
Click Save
Click Open
Login as normal.
Using either of these methods will mean the machine you are login onto your pi with (Client) has those ports as if they were local. Once you have Jupiter notebook installed you can do the following:
Run jupyter notebook:
Code: Select all
sudo jupyter notebook
127.0.0.1:8888
You should then be presented with the Jupyter Dashboard.
-
- Posts: 1
- Joined: Sat Mar 17, 2018 12:41 pm
Re: jupyter notebook (was ipython notbook)
Hello there,
I need to set up a ad hoc wifi jupyterlab server to ssh directly into without a rounter.
As far I can see, that’s possible.
My needs is to use jupyter in an tablet where I don’t have internet access and the tablet can’t run a server alone (ipad).
I don’t have a laptop or money for one so I’m thinking that a Raspberry could be the cheaper jupyter notebook server I could find to code offline.
But, did the raspberry zero w really supports it? I mean, it’s powerfull enough to compile, plot, operate (not too big) matrix... ?
Sure I will not think it as a powerfull server, it’s just for simple code blocks, small matrix operations and persist data, what I’m thinking is if it’s slowdown the operation because of the 512mb ram only... for your experience, it’s the “jupyberry” a ”usable enough” notebook server?
Thank you, cheers!
I need to set up a ad hoc wifi jupyterlab server to ssh directly into without a rounter.
As far I can see, that’s possible.
My needs is to use jupyter in an tablet where I don’t have internet access and the tablet can’t run a server alone (ipad).
I don’t have a laptop or money for one so I’m thinking that a Raspberry could be the cheaper jupyter notebook server I could find to code offline.
But, did the raspberry zero w really supports it? I mean, it’s powerfull enough to compile, plot, operate (not too big) matrix... ?
Sure I will not think it as a powerfull server, it’s just for simple code blocks, small matrix operations and persist data, what I’m thinking is if it’s slowdown the operation because of the 512mb ram only... for your experience, it’s the “jupyberry” a ”usable enough” notebook server?
Thank you, cheers!
Re: jupyter notebook (was ipython notbook)
+1 to this approach.
As someone who's new to the raspberry pi / linux / command line / coding / python scene, I've been finding progress to be slow when saving / running / testing / debugging code on an SSH command line interface.
Rich107's instructions above are legit and will make your experience with accessing your Raspberry Pi remotely to do coding work immensely more efficient and enjoyable.
Big ups Rich107!
Cheers,
DC
As someone who's new to the raspberry pi / linux / command line / coding / python scene, I've been finding progress to be slow when saving / running / testing / debugging code on an SSH command line interface.
Rich107's instructions above are legit and will make your experience with accessing your Raspberry Pi remotely to do coding work immensely more efficient and enjoyable.
Big ups Rich107!
Cheers,
DC