[PYTHON] Debian Intel Edison and put scikit-learn

It's a shame to use Edison only like a microcomputer that operates sensors and actuators. Edison isn't just at the end of the IoT.

The general procedure is as follows.

  1. Preparation of mother ship
  2. Edison initial settings
  3. Edison's Python settings.

Well then, let's go!

*** There are quite a few duplications with the previous article. ** **

Preparation of mother ship

Download the Debian image.

Forget about Yocto. Goodbye Yocto ... It was a short time but it was fun, I'm sure I'll never forget you. I'll be back when I have more packages. ..

From ubilinux, Image for Edisondownload.

Install dfu-util on the mother ship.

I think you can use it from the package manager of each distribution. Whether it's apt, yum, MacPorts or Homebrew, you'll love it. However, the head family site seems to have dropped as of November 7, 2014. Oh, I'm in trouble.

Write to the actual Edison machine.

At this point, do not connect Edison to the mother ship yet.

Unzip the downloaded Debian image tar.gz. Go to the extracted toFlash directory and

sudo flashall.sh

After that, Edison was connected to the mother ship. Burning of the image begins. ** It takes more than 5 minutes **, so please wait leisurely. Even after writing is finished, it is necessary to reboot twice, so ** leave it as it is for about 2 minutes after the terminal returns **.

Edison default settings

As usual, serially connect to Edison with screen or TeraTerm. ** Baudrate is 115200 **. Login is ** root / edison **.

cat /etc/debian_version

If you do

7.6

I'm glad to hear that.

Wireless LAN settings

For the time being, nothing will start unless you connect to the network and update the package, so set up the wireless LAN. Please set ** / etc / network / interfaces ** appropriately. In my case, the SSID is TEMP and the password is 1234 on the WPA2 network, so I edited the relevant part as follows.

iface wlan0 inet dhcp # For WPA wpa-scan-ssid 1 # For stealth wpa-ssid TEMP wpa-psk 1234

After editing,

ifup wlan0

You can start wifi with.

Allotted IP is always available

/sbin/ifconfig

You can check it in the item ** wlan0 ** of.

If you can confirm that you can participate in the network properly,

apt-get update

Let's update the existing package information with.

Installation of required packages for APT

apt-get install sudo python-dev libgfortran3 subversion git apt-get install libblas-dev liblapack-dev

For the time being, this is about it. You can install gfortran at this point, so it's very easy (compared to Yocto ...).

Create user

It's easy to do various things with root privileges, but it's troublesome if you destroy the environment. Also, to escape the library under / home, which will be explained later. Below, create a user named ** alva **, set a password, and even grant sudo privileges.

useradd -m -g users -s /bin/bash alva passwd alva

visudo Added the following alva line

# User privilege specification root ALL=(ALL:ALL) ALL alva ALL=(ALL:ALL) ALL

Addition to / etc / hosts

I got a warning when I did ** sudo **. With reference to here, the following was added to ** / etc / hosts **.

127.0.1.1 ubilinux

From here on, let's do it with the created alva user. Exit the root account and log in again with the alva account.

Edison Python settings

Now, I'm going to put Python packages for analysis into Edison, but before that. Since the space under __ / __ of Edison is not allocated so much, set to install tools and libraries under __ / home / __.

Specify the installation destination under / home

Add the following to ** ~ / .bashrc **.

export PATH=~/.local/bin:$PATH export PYTHONPATH=~/.local/lib/python2.7/

After inputting

source ~/.bashrc

Then, enable the setting. (Or re-login)

further. Create ** ~ / .pydistutils.cfg ** and put it inside

[install] user=1

Enter. This is OK.

Installation of various analysis tools with pip

I don't use apt because I want to use the latest python package. Also, when I tried to install pip via apt, I was about to install 2.6 series python, so I decided to install it myself. First of all

Installation of setuptools

wget https://bootstrap.pypa.io/ez_setup.py --no-check-certificate -O - | python

pip installation

easy_install pip

Various installations

pip install numpy scipy pandas scikit-learn PyBrain

Note that it also takes 3 to 4 hours here. At this time, if you do something strange behind the scenes, the build will be messed up in the middle because the system memory is insufficient. Leave it alone.

Inherit PYTHONPATH settings after sudo

** Additional items ** After making the above changes, the tools installed in ~ / .local / bin did not pass through * sudo *, or the Python library installed under ~ / .local did not read. I made the following changes.

sudo visudo Add the installation destination PATH to the secure_path item. Set PYTHONPATH in env_keep.

Defaults secure_path="/home/alva/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" Defaults env_keep += "PYTHONPATH"

If you set env_keep + = "PATH, PYTHONPATH", the management path of the / sbin system will be dropped this time, so it ended up like this. To be honest, I realize that this setting method is not smart.

Also, ** PYTHONPATH ** in ** ~ / .bashrc **,

export PYTHONPATH=~/.local/lib/python2.7/:~/.local/lib/python2.7/site-packages/

And, if you do not include site-packages as well, import may not work.

Set shared libraries to come to see things under / home

sudo sh -c "echo $HOME/.local/lib > /etc/ld.so.conf.d/locallib.conf"

sudo ldconfig

Recommended Posts

Debian Intel Edison and put scikit-learn
Startup Intel Edison
Geolocation on Intel Edison
Push notification to Intel Edison