I recently bought my first raspberry Pi try to try out the latest open software innovations in the field of machine learning and A.i. What I soon discovered was that building these libraries on arm was quite difficult. I bought the device without reading too much into it , other than the fact that it was a small computer with WiFi and Bluetooth built in, and it was built for open source purposes. The installation of the libraries required was painful and time consuming... so in an effort to do my part as a developer here are my notes on the subject.
Operating system: Debian 32bit
Processor nickname for Python packages : armhf/armv7
The Debian operating system is compatible with python so we can add code other people have written(called packages) to help us do things. These packages can come in 3-4 forms typically.
A library you compile as with pip( a package manager)
- A .whl file also known as a wheel file that you can extract
like a zip file and then run pip install to run the package
- A Bourne shell script (.sh ) file
- Building the package from source ,which has its own set of instructions.
Before you can do any of this however first you must update and upgrade your raspberry pi.
The next step is downloading a list of dependencies that will help us compile tensorflow and pytorch
Once we’ve added and updated python 3.6-3.7 and virtual environment, we can really get started.
The virtual environment is good for installing packages in isolation, so that different projects can have different versions of software without stepping on the other’s toes.
Some of your programs will require an Alias in order to point to the correct package within an environment.
Now that you’ve installed the dependencies download the .whl file that you’ve found and extract it to your place of choice.
Go into terminal app and drill down into the place you extracted the files by repeating the command “cd folder name” where foldername is the name of the next folder you need to go into.
Copy the name of the .whl file by right clicking and clicking rename. Ctrl + A then Ctrl + C to copy and right click paste into the terminal after the command “pip install” the final command will look like “pip install ./wheelfilename.whl”
After pressing enter and following the commands .. the software should install and you’re ready for pytorch.
The instructions for installing pytorch are basically identical
And will only differ in the additional dependencies if needed.
A few things to remember while doing this process.... in the middle of one of the intermediate steps(installing a particular software package) the software could error and break , or you could be required to download other packages in order to install the required ones. This is the painful part.
You must now look for any packages the operating system claims you don’t have saying “no module absl” found.. and other similar errors. My best advice for dealing with these errors is to copy the error from the terminal and then pasting it into google. If that doesn’t help you, like the case where I needed help on something where there were only a small group of people developing it actively, there are other options.
The way to get around this is to join a forum where developers talk and share, and ask questions and read issues other developers are having.
Backing up your data:
While doing this process it’s essential that you download all the .whl files you can in order to preserve them just in case they are removed from their locations online. Then move all the files to a usb for backing up.
An instruction file documenting how you run the scripts may be helpful as well.
Comments
Post a Comment