How to install Conda and Docker on your Raspberry Pi

I recently installed raspberry Pi lite OS and added support for Python 3 and Docker and just wanted to document steps and links to relevant info to make this installation painless. Thinking of future me!

Miniconda

At time of writing this post only Python 3.5/3.6 are available for raspberry Pi - Jonathan Helmus, who is the developer of berryconda, is working on adding Python 3.7 support. These instructions are based on this stackoverflow answer

Installation of Miniconda on Raspberry Pi

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
sudo md5sum Miniconda3-latest-Linux-armv7l.sh
sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh

Accept the license agreement with yes

When asked, change the install location: /home/pi/miniconda3

Do you wish the installer to prepend the Miniconda3 install location to PATH in your /root/.bashrc ? yes

Now add the install path to the PATH variable:

sudo nano /home/pi/.bashrc

Go to the end of the file .bashrc and add the following line:

export PATH="/home/pi/miniconda3/bin:$PATH"

Save the file and exit.

To test if the installation was successful, open a new terminal and enter

conda

Adding Python 3.5 / 3.6 to Miniconda on Raspberry Pi

Add the Berryconda package manager by jjhelmus (kind of an up-to-date version of the armv7l version of Miniconda):

conda config --add channels rpi

Now you are able to install Python 3.5 or 3.6 without the need for compiling it:

conda install python=3.5
conda install python=3.6

You can now create environments in the usual way:

conda create --name py35 python=3.5

The new environment “py35” can now be activated:

source activate py35

You have suscessfully installed python 3 in your raspberry Pi

Docker

The following instructions are based on steps laid out here with some small modifications/additions.

Install the following prerequisites.

sudo apt-get install apt-transport-https ca-certificates software-properties-common -y

Download and install Docker.

curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Give the pi user the ability to run Docker.

sudo usermod -aG docker pi

Import Docker CPG key.

sudo curl https://download.docker.com/linux/raspbian/gpg

Setup the Docker Repo.

sudo nano /etc/apt/sources.list

Add the following line and save:

deb https://download.docker.com/linux/raspbian/ stretch stable

Patch and update your Pi.

sudo apt-get update
sudo apt-get upgrade

Run the following command or Logout and login again

newgrp docker

Start the Docker service.

sudo systemctl start docker.service

To verify that Docker is installed and running.

docker info

and finally:

docker run hello-world

Comments

comments powered by Disqus