MiniConda On Raspberry Pi for Machine Learning

Hemant Sharma 04 May, 2021 • 5 min read
This article was published as a part of the Data Science Blogathon.

Hello Geeks! In this article, we are going to learn how to use raspberry pi for Machine Learning.Raspberry pi is cheap, and kind of interesting to work with. We will about applications of Data Science. Data Science is getting huge attention day by day and this tech is growing so fast. So, let’s get started…..😉

Introduction

As we all know how machine learning is improving the lives of people. Machine learning is helping businessmen to an ordinary person. Tech enthusiasts are always running to find something new in the world of data science and machine learning, they work on several algorithms to produce the most efficient model. Similarly, they also work on the hardware to improve its performance and to satisfy the user requirements. The hardware we are working on is raspberry pi. First, we will set up the raspbian OS on the raspberry pi 3 and then configure the miniconda on it, we have explained it in more detail in the article below.

 

Raspberry Pi

Raspberry pi is a small-size computer. It is very cheap and reliable hardware, raspberry pi has all the components which a fully functioning computer would have, like RAM, CPU, HDMI, USB, Ethernet, and many more.

Raspberry pi provides several hardware versions, you could use according to your requirements. For intensive users, raspberry pi even has 8 GB of RAM, which surely shows the power of pi. Some of the raspberry pi models are listed below.

  • Raspberry Pi 1 Model B
  • Raspberry Pi 1 Model A
  • Raspberry Pi 1 Model B+
  • Raspberry Pi 3 Model B
  • Raspberry Pi Zero W

Raspberry pi is very famous in school and university projects due to its vast area of implementation. It can be used as a personal desktop or gaming station, raspberry pi provides Retro pi Games. Some of the early penetration testers also use raspberry pi as the testing and hacking lab by installing Kali Linux on it.

 

MiniConda

What is it, similarity in anaconda and miniconda

Before directly jumping to miniconda we must know what is conda? So, conda is a management tool or system. Conda performs two kinds of system management; one is environment system management and the other is package system management.

Miniconda is just a minimalistic version of conda for various hardware according to the requirements. The high-performance version of conda is Anaconda, which comes with several machine learning tools like Jupyter notebook, spyder, and many more.

Miniconda comes with very minimal support like python, conda, and some dependent modules. If you have conda which means you can easily do several events like create, save, switch between environments on the system.

 

Steps Involved

Now we are going to perform the activity. The process is well documented stepwise. So, you can also follow with me.

Step 1

First of all, we have to write the raspbian OS on the microSD card using some tool. After that, we will start further configurations.

For downloading the raspbian os click here. There are several options for the raspberry pi, we are going to choose the desktop version with full support. You could also use NOOBS and raspbian Lite for this.

MiniConda On Raspberry Pi  - steps involved

The OS is about 3 GB so have patience during the download. After the download, we gonna need one more tool called ether, to download etcher click here.

After both the download, we will plug the microSD card and start the ether software. Then we have selected the downloaded ISO file and the microSD card. Ether UI is very simple and easy. Now click on Flash and it will automatically install raspbian OS on it.

MiniConda On Raspberry Pi  rasbian os

After the flash completes, Insert the microSD card inside the raspberry pi. Now, start the pi by giving power using a USB cable and connect raspberry pi to the monitor using HDMI or VGA port.

 

Step 2

Now, raspbian os will start at the login window, the default login credentials are pi (username) and raspberry (password). Log in to the desktop by using these credentials.

MiniConda On Raspberry Pi  step 2

Now, open the terminal, and update the package manager, also check if any python version is installed on the pi.

Use the below command to update.

sudo apt update

Use the below command to upgrade.

sudo apt upgrade

Now check the python version.

python --version

Step 3

– Download miniconda and configure it.

wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh

Enter bellow command and change the default directory to /home/pi/miniconda3

sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh

Add the directory to the path variable and the “.bashrc” file. Open the “.bashrc” file from the below command.

sudo nano /home/pi/.bashrc

Now add these lines in the “.bashrc” file and save it.

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

Now reboot the raspberry pi.

sudo reboot

Step 4

Now install Jupyter Notebook.

pip install jupyter-notebook

Run Jupyter Notebook on Raspberry pi.

jupyter-notebook

Applications of Data Science and Raspberry Pi

There are various platforms and modules for data science, those can be used on raspberry pi in several ways. Some of those assets are listed below.

Tensorflow

Tensorflow is a library provided and maintained by Google, it is open-source that means anyone can use it. Google has a group of researchers who works on machine learning and deep learning using this open-source library. We could use this library on raspberry pi and perform various projects like object detection from a video (pi also has a camera slot for picam), or checking the parking site. You could even code a self-driving car using TensorFlow.

Google AIY Kit

With the help of the Google AIY kit, you can create your own language processor that can be connected to the Google assistant. Google AIY stands for Google Artificial Intelligence Yourself. Google AIY kit also provides vision and voice-enabled components that can be used in various ways to produce some nice projects.

Jenkins Automation

You could even install the Jenkins server on raspberry pi. As we all know, Jenkins is such a powerful tool in the world of automation. Using this Jenkins we can automate our Machine Learning models, which produce more accurate models. A single raspberry can control many Jenkins slave nodes.

I hope you learned something new from this article or it might inspire you to build something very interesting. If you have any sort of doubts or suggestions please comment down.

The media shown in this article on MiniConda On Raspberry Pi are not owned by Analytics Vidhya and is used at the Author’s discretion. 

Hemant Sharma 04 May 2021

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers

Clear

Anthony Wang
Anthony Wang 23 Jul, 2021

When I tried to indtall jupyter-notebook pip install jupyter-notebook Got the the following error message Could not find a version that satisfies the requirement jupyter-notebook (from versions: ) No matching distribution found for jupyter-notebook How to resolve it?