Download Jupyter Notbook into Raspbian for robots

Hi, i would like to dowload jupyter notebook on raspbian for robots, i first discovered it on DexterOs when i went to the python section and i loved it, can you tell please if it’s possible to do that ?

This links explain how to dowload it on a raspberry pi but having not just a “raspberry pi”, i didn try and i wanted to know if there is no problem to do it or if it just possible.

The links
https://custom-build-robots.com/raspberry-pi-robot-cars/jupyter-notebook-raspberry-pi-installation/12152?lang=en

Thx for reading

1 Like

First: Welcome in!

Second: I’ve never done this - though it sounds like a good idea, so take anything I say with a large chunk of salt.

If I were trying to do this, this is what I’d do:

  1. Do the install as instructed. Verify that it works.

  2. Using either/both the Dexter flash drive and/or the SD with DexterOS, copy the Jupyter notebooks and files that represents the work you’ve done.

Note that at least some of the stuff in there may be in Dexter’s “block” based language and will not work in Raspbian and/or Raspbian for Robots.

P.S.
I spent a LOT of time trying to figure out how to use the Jupyter notebooks and ecosystem. All I got put of it was a crashing headache.

Any help or guidance you could give on using the Jupyter ecosystem would be gratefully appreciated!

1 Like

I’ve installed it a few times on my own personal Pis.
The link you shared is to install Jupyter Notebook. What is installed on DexterOS is JupyterLab, which includes jupyter notebooks.

pip install jupyterlab’ or better yet ‘python3 -m pip install jupyterlab

1 Like

Thx very much for responding fast and sorry for my late response , i tried to install it by using the command line
python3 -m pip install jupyterlab ’ but i couldn’t, it says that jupyterlab requires Python 3.5 or greater and im actually on Python 2.7.13.
I tried an update - upgrade and then i tried to install python 3.7 by using ‘sudo apt-get install python 3.7.3 ’ but it seems that it only installed the 3.7.3 version of the docs and that im still on 2.7.13 version of python

P.s.
I like using jupyterlab to write some scripts and i find it very easy, the fact that you can run each cells of code, step by step, make it very clear. but you must run all the previous cell before running the fifth one for example.

1 Like

I’m not an expert at Python, but I remember that the two versions of Python can exist side-by-side. You may have a different icon to launch Python-3. Look in the startup menu under “all” and see if you find it.

Typing in ‘python’ will result in python2, you have to specify python3 to get that version. JupyterLab and Jupyter notebooks no longer support python2.

When you type python3 on the command line, on its own, it will tell you which version of python3 is installed.

2 Likes

So yes, there is two version as i saw, the 2.7.13 and the 3.5.3 if im not wrong

When i try to install jupyterlab with the python3 command, it says that i can’t install it if i dont have the 3.6 version or greater of python3 and i couldn’t install it. i don’t how i can add the version of python 3.6 with the 3.5.3 and 2.7.13 version. Do i need to create a virtual env ?

i tried to install the 3.6 version with the command line ‘ sudo apt-get install python 3.6 ’ but i got an error and after that i couldn’t get access to my rover through vnc only through Terminal,
so i reinstalled the OS on an other sd card with more memory.

1 Like

Pardon me for laughing, but this sounds so much like what I am doing to fix a sound driver problem that is being caused by a Win-10 update on my wife’s computer. :laughing:!

1 Like

I’m sorry you’re encountering these hurdles. They really are a pain.
Your best bet is to move to the Buster version of Raspbian, as this one comes with python 3.7 (if I recall correctly)
Otherwise, you’ll have to compile Python onto your SD card and that takes a few hours.

1 Like

Disclaimer: I don’t know anything about jupyter notebook install - This is a method I used to install a specific version of Python and create virtual environments to use it:

Virtual Python Environments With Specific Python Versions

Using:

python3 -m venv  
pyenv  

Virtual environments are part of the Python3 package (since v3.3)

  • To create a virtual environment for a project:
$ cd my_project_folder
  • using the default python3 version and no installed site packages
$ python3 -m venv  dir_name     (common to use venv for dir_name)    or
  • or to use default python3 version and the installed site packages
$ python3 -m venv --site-packages venv-w-site-packages
  • To use the virtual env:
$ cd my_project_folder
$ source venv/bin/activate    
or 
$ source venv-w-site-packages/bin/activate
(venv) $
or
(venv-w-site-packages) $

To save the current state of the environment:

(venv) $ pip freeze > requirements.txt  

To recreate installed packages in a new venv:

(venv) $ pip install -r requirements.txt

To stop using the virtual env:

(venv) $ deactivate

!!! Be sure to add the virtual environment folder to the .gitignore list if not named venv


pyenv - To run a Python version different than the installed “system python”

see https://yeti.co/blog/setting-up-a-raspberry-pi-with-raspbian-and-pyenv-running-python-35/

and see: https://github.com/pyenv/pyenv

  1. Setup Dependencies: WARNING Updating Your System Can Break Stuff !!! WARNING
sudo apt-get update && sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev openssl bzip2
  1. Run pyenv-installer:
cd ~
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
  1. Copy lines into ~/.bashrc (or any file executed by ~/.bashrc)
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
  1. Run the .bashrc:
source ~/.bashrc     or     . ~/.bashrc
  1. To create a Python version for use in your environments
cd ~
pyenv install 3.7.6

and in 15 minutes you should have the python available in ~/.pyenv/bin
(at one point temperature was 75 and load hit 4.3)

  1. Familiarize with all pyenv commands:
    https://github.com/pyenv/pyenv/blob/master/COMMANDS.md

  2. See what python version are available and what is current

$ pyenv versions    - to show all versions and * by current
or
$ pyenv version     - to show current version
  1. Designate a project local python version
cd <Project>
pyenv local 3.7.6
  1. create a virtual environment that uses that version of python
cd \<Project\>
python -m venv [--site-packages] venv
  1. Test it worked
$ source ~/.bashrc
$ source venv/bin/activate
(venv) $ python --version
(venv) $ deactivate
$ pyenv which python3     - displays path to python in use    

To designate a project should use the system version:

$ pyenv global          - reports what current global version is
$ pyenv global system   - sets global to system version  !!! Danger !!!
$ pyenv local --unset

To run a virtual env from the root crontab:

* * * * * /usr/bin/env bash -c 'YOUR_COMMAND_HERE' > /dev/null 2>&1
e.g.: 
@reboot /usr/bin/env bash -c 'cd /home/user/project && source /home/user/project/env/bin/activate && ./myprogram.py arg' > /dev/null 2>&1
3 Likes

Thx for all your replies !

2 Likes