I'm new in embedded programming, and would like to understand what I need to do to run python scikit-learn on a capable embedded processor.
See Raspberry Pi as an example.
-
stackoverflow.com/questions/26677655/…Dima– Dima2017-02-26 02:31:28 +00:00Commented Feb 26, 2017 at 2:31
2 Answers
First things first: I think it's a good practice to develop in virtual environments, as opposed to installing everything system-wide. Therefore, I suggest you go ahead and spin up one for Python 3.
sudo pip3 install virtualenv
virtualenv -p python3 .venv
source .venv/bin/activate
Once you have that, install the dependencies for scikit-learn.
sudo apt-get update
sudo apt-get install gfortran libatlas-base-dev libopenblas-dev liblapack-dev -y
And lastly, let's install the actual scikit-learn library. Instead of just pip installing it, which will proceed on compiling the whole stuff, which takes a lot of time, just use the wheel from piwheels.org.
pip3 install scikit-learn --index-url https://piwheels.org/simple
And that's it. Now, having said that, please be aware of the available wheels for a given version of Python. For instance, at this moment, the scikit-learn library is only available to 3.4.x/3.5.x versions of it. That's an okay thing, as Python 3.5.x is already present on Raspbian.
1 Comment
scikit-learn will run on a Raspberry Pi just as well as any other Linux machine.
To install it, make sure you have pip3 (sudo apt-get install python3-pip), and use sudo pip3 install scikit-learn.
All Python scripts utilizing scikit-learn will now run as normal.
5 Comments
python3 in the terminal, rather than python?