Link to home
Start Free TrialLog in
Avatar of ttist25
ttist25

asked on

Start Jupyter Notebook at Boot Raspbian/BerryConda3

Good morning!

I have installed raspbian and berryconda  on a pi3.

I'm failing miserably at getting the jupyter notebook server to run at boot.

Here is some info that might help:
Here is the bottom of my rc.local:
# --------------------------------------------------------------------
# My Configuration
#---------------------------------------------------------------------
# Start Jupyter Server at boot
/home/pi/berryconda3/bin/jupyter-notebook
exit 0

Here is what I get when I type "which jupyter":
/home/pi/berryconda3/bin/jupyter

Here's my path:
/home/pi/berryconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

And finally if I type "jupyter-notebook" from an ssh session as user pi - it starts the jupyter notebook server w/o issue

Thanks in advance for any help.  This is driving me nutz!  :D
ASKER CERTIFIED SOLUTION
Avatar of gelonida
gelonida
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ttist25
ttist25

ASKER

Thanks for the response gelonida and sorry for the delay in my response.  

The jupyer notebook command actually starts a "notebook server" that can then be accessed from a web browser.  My goal was to have a headless PI sitting over on the shelf that I could access from any computer on my network.  I thought it would be a great use of a PI3 that was sitting in my desk drawer doing nothing (it remains to be seen whether it's actually good in practice :D).  

Anyway, I managed to get this working after talking to my son.  Here is his solution:
1.  Create a script "/home/pi/startup.sh" with the following lines:
# shell script to set path and run jupyter notebook server at boot
export PATH="$PATH:/home/pi/berryconda3/bin/"
jupyter notebook

Open in new window


2.  Add the following to /etc/rc.local right above exit 0:
# Start Jupyter Notebook Server at boot
su pi -c 'bash /home/pi/startup.sh'

Open in new window

So far this seems to be working great.  If the power goes out, no worries, the notebook server starts up all on its own and I can browse to the PI and access the notebooks I've created.  Again, thanks for the help!
Yep using su to start a process as another user is the right thing to do. Creating an intermediate script in order to keep /etc/rc.local is also a good idea.

Well if you ever want to autostart an application on a pi with a screen and desktop you have some pointers.

Happy notebooking.