Edited at

「カラー図解 Raspberry Piではじめる機械学習 基礎からディープラーニングまで」金丸 隆志 著を動かそうとしている。

「カラー図解 Raspberry Piではじめる機械学習 基礎からディープラーニングまで」 金丸 隆志 著を動かそうとしている。

http://bookclub.kodansha.co.jp/product?item=0000226701

pi@raspberrypi001:~ $ apt-get update

Reading package lists... Done
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
pi@raspberrypi001:~ $ sudo apt-get update
Get:1 http://archive.raspberrypi.org/debian stretch InRelease [25.3 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:3 http://archive.raspberrypi.org/debian stretch/main armhf Packages [174 kB]
Get:4 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [34.3 kB]
Get:6 http://raspbian.raspberrypi.org/raspbian stretch/contrib armhf Packages [56.9 kB]
Fetched 12.0 MB in 1min 11s (167 kB/s)
Reading package lists... Done
pi@raspberrypi001:~ $ apt-get install docker
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
pi@raspberrypi001:~ $ sudo apt-get install docker
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
docker
0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
Need to get 11.7 kB of archives.
After this operation, 21.5 kB of additional disk space will be used.
Get:1 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf docker armhf 1.5-1 [11.7 kB]
Fetched 11.7 kB in 1s (9,420 B/s)
Selecting previously unselected package docker.
(Reading database ... 115479 files and directories currently installed.)
Preparing to unpack .../docker_1.5-1_armhf.deb ...
Unpacking docker (1.5-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up docker (1.5-1) ...
pi@raspberrypi001:~ $ wget http://bluebacks.kodansha.co.jp/books/9784065020524/appendix/attachments/mlbb-sample.zip
--2018-10-09 23:51:10-- http://bluebacks.kodansha.co.jp/books/9784065020524/appendix/attachments/mlbb-sample.zip
Resolving bluebacks.kodansha.co.jp (bluebacks.kodansha.co.jp)... 143.204.77.198, 143.204.77.208, 143.204.77.37, ...
Connecting to bluebacks.kodansha.co.jp (bluebacks.kodansha.co.jp)|143.204.77.198|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3244821 (3.1M) [application/zip]
Saving to: ‘mlbb-sample.zip’

mlbb-sample.zip 100%[================================>] 3.09M 1.35MB/s in 2.3s

2018-10-09 23:51:13 (1.35 MB/s) - ‘mlbb-sample.zip’ saved [3244821/3244821]

pi@raspberrypi001:~ $ ls
Desktop Downloads mlbb-sample.zip Pictures python_games Videos
Documents MagPi Music Public Templates work
pi@raspberrypi001:~ $ unzip mlbb-sample.zip
Archive: mlbb-sample.zip
inflating: ml-03-01-version.py
inflating: ml-04-01-irisbasic.py
inflating: ml-04-02-2feat2class01.py
inflating: ml-04-03-2feat2class12.py
inflating: ml-04-04-2feat3class.py
inflating: ml-04-05-4feat3class.py
inflating: ml-05-01-2feat3class-nn.py
inflating: ml-05-02-4feat3class-nn.py
inflating: ml-06-01-digitsbasic.py
inflating: ml-06-02-images.py
inflating: ml-06-03-plot3d.py
inflating: ml-06-04-svc.py
inflating: ml-06-05-nn.py
inflating: ml-06-06-svc-traintest.py
inflating: ml-06-07-nn-traintest.py
inflating: ml-06-08-svc-gui.py
inflating: ml-06-09-nn-gui.py
inflating: ml-06-10-svc-gui-mod.py
inflating: ml-06-11-nn-gui-mod.py
inflating: ml-07-01-janken-cui.py
inflating: ml-07-02-perceptron-cui.py
inflating: ml-07-03-janken-gui.py
inflating: ml-07-04-perceptron-gui.py
inflating: ml-08-01-cameracheck.py
inflating: ml-08-02-binary.py
inflating: ml-08-03-learn.py
inflating: ml-08-04-recognition.py
inflating: ml-09-01-janken.py
inflating: ml-09-02-janken-shorten.py
inflating: ml-10-01-iris-deep-learn.py
inflating: ml-10-02-iris-deep-load.py
inflating: ml-10-03-digits-cnn-learn.py
inflating: ml-10-04-digits-cnn-load.py
inflating: ml-10-05-digits-cnn-gui.py
inflating: ml-10-06-digits-cnn-gui-mod.py
inflating: ml-10-07-hand-cnn-learn.py
inflating: ml-10-08-hand-cnn-load.py
inflating: ml-10-09-janken-deep.py
inflating: ml-10-10-janken-deep-shorten.py
inflating: ml-digits-cnn.h5
inflating: ml-hand-cnn.h5
creating: ml-images/
inflating: ml-images/comp_choki.png
inflating: ml-images/comp_gu.png
inflating: ml-images/comp_pa.png
inflating: ml-images/human_choki.png
inflating: ml-images/human_gu.png
inflating: ml-images/human_pa.png
inflating: ml-iris-deep.h5
creating: ml-learn/
inflating: ml-learn/img_choki000.png
inflating: ml-learn/img_choki001.png
inflating: ml-learn/img_choki002.png
inflating: ml-learn/img_choki003.png
inflating: ml-learn/img_choki004.png
inflating: ml-learn/img_choki005.png
inflating: ml-learn/img_choki006.png
inflating: ml-learn/img_choki007.png
inflating: ml-learn/img_choki008.png
inflating: ml-learn/img_choki009.png
inflating: ml-learn/img_choki010.png
inflating: ml-learn/img_choki011.png
inflating: ml-learn/img_choki012.png
inflating: ml-learn/img_choki013.png
inflating: ml-learn/img_choki014.png
inflating: ml-learn/img_gu000.png
inflating: ml-learn/img_gu001.png
inflating: ml-learn/img_gu002.png
inflating: ml-learn/img_gu003.png
inflating: ml-learn/img_gu004.png
inflating: ml-learn/img_gu005.png
inflating: ml-learn/img_gu006.png
inflating: ml-learn/img_gu007.png
inflating: ml-learn/img_gu008.png
inflating: ml-learn/img_gu009.png
inflating: ml-learn/img_gu010.png
inflating: ml-learn/img_gu011.png
inflating: ml-learn/img_gu012.png
inflating: ml-learn/img_gu013.png
inflating: ml-learn/img_gu014.png
inflating: ml-learn/img_pa000.png
inflating: ml-learn/img_pa001.png
inflating: ml-learn/img_pa002.png
inflating: ml-learn/img_pa003.png
inflating: ml-learn/img_pa004.png
inflating: ml-learn/img_pa005.png
inflating: ml-learn/img_pa006.png
inflating: ml-learn/img_pa007.png
inflating: ml-learn/img_pa008.png
inflating: ml-learn/img_pa009.png
inflating: ml-learn/img_pa010.png
inflating: ml-learn/img_pa011.png
inflating: ml-learn/img_pa012.png
inflating: ml-learn/img_pa013.png
inflating: ml-learn/img_pa014.png
creating: ml-sound/
inflating: ml-sound/jankenpon.mp3
inflating: ml-sound/pon.mp3
inflating: ml-sound/README.txt
pi@raspberrypi001:~ $ ls
Desktop ml-06-08-svc-gui.py ml-10-06-digits-cnn-gui-mod.py
Documents ml-06-09-nn-gui.py ml-10-07-hand-cnn-learn.py
Downloads ml-06-10-svc-gui-mod.py ml-10-08-hand-cnn-load.py
MagPi ml-06-11-nn-gui-mod.py ml-10-09-janken-deep.py
ml-03-01-version.py ml-07-01-janken-cui.py ml-10-10-janken-deep-shorten.py
ml-04-01-irisbasic.py ml-07-02-perceptron-cui.py mlbb-sample.zip
ml-04-02-2feat2class01.py ml-07-03-janken-gui.py ml-digits-cnn.h5
ml-04-03-2feat2class12.py ml-07-04-perceptron-gui.py ml-hand-cnn.h5
ml-04-04-2feat3class.py ml-08-01-cameracheck.py ml-images
ml-04-05-4feat3class.py ml-08-02-binary.py ml-iris-deep.h5
ml-05-01-2feat3class-nn.py ml-08-03-learn.py ml-learn
ml-05-02-4feat3class-nn.py ml-08-04-recognition.py ml-sound
ml-06-01-digitsbasic.py ml-09-01-janken.py Music
ml-06-02-images.py ml-09-02-janken-shorten.py Pictures
ml-06-03-plot3d.py ml-10-01-iris-deep-learn.py Public
ml-06-04-svc.py ml-10-02-iris-deep-load.py python_games
ml-06-05-nn.py ml-10-03-digits-cnn-learn.py Templates
ml-06-06-svc-traintest.py ml-10-04-digits-cnn-load.py Videos
ml-06-07-nn-traintest.py ml-10-05-digits-cnn-gui.py work
pi@raspberrypi001:~ $ python ml-03-01-version.py
scikit-learnはインストールされていません
numpyのバージョンは1.12.1です
scypyはインストールされていません
matplotlibはインストールされていません
PIL(Pillow)のバージョンは4.0.0です
kerasがインストールされていないか、まだ設定が済んでいません
theanoはインストールされていません
pi@raspberrypi001:~ $

pi@raspberrypi001:~ $ pip install scikit-learn

Collecting scikit-learn
Downloading https://files.pythonhosted.org/packages/0f/d7/136a447295adade38e7184618816e94190ded028318062a092daeb972073/scikit-learn-0.20.0.tar.gz (28.1MB)
99% |████████████████████████████████| 28.1MB 2.7MB/s eta 0:00:01Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 659, in unpack_http_url
hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 571, in written_chunks
for chunk in chunks:
File "/usr/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 560, in resp_read
decode_content=False):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 432, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 380, in read
data = self._fp.read(amt)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/filewrapper.py", line 63, in read
self._close()
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/filewrapper.py", line 50, in _close
self.__callback(self.__buf.getvalue())
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/controller.py", line 275, in cache_response
self.serializer.dumps(request, response, body=body),
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/serialize.py", line 87, in dumps
).encode("utf8"),
MemoryError
pi@raspberrypi001:~ $ pip install pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 188kB/s
Installing collected packages: pip
Successfully installed pip-18.1
pi@raspberrypi001:~ $ pip install --upgrade pip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
pi@raspberrypi001:~ $ pip3 install scypy
Collecting scypy
Could not find a version that satisfies the requirement scypy (from versions: )
No matching distribution found for scypy
pi@raspberrypi001:~ $ pip3 install pip3
Collecting pip3
Downloading https://www.piwheels.org/simple/pip3/pip3-0.2-py3-none-any.whl
Installing collected packages: pip3
Successfully installed pip3-0.2
pi@raspberrypi001:~ $ pip3 install scikit-learn
Collecting scikit-learn
Downloading https://www.piwheels.org/simple/scikit-learn/scikit_learn-0.20.0-cp35-cp35m-linux_armv7l.whl (11.7MB)
100% |████████████████████████████████| 11.7MB 23kB/s
Collecting numpy>=1.8.2 (from scikit-learn)
Downloading https://www.piwheels.org/simple/numpy/numpy-1.15.2-cp35-cp35m-linux_armv7l.whl (6.4MB)
100% |████████████████████████████████| 6.4MB 38kB/s
Collecting scipy>=0.13.3 (from scikit-learn)
Downloading https://www.piwheels.org/simple/scipy/scipy-1.1.0-cp35-cp35m-linux_armv7l.whl (36.5MB)
100% |████████████████████████████████| 36.5MB 7.8kB/s
Installing collected packages: numpy, scipy, scikit-learn
Successfully installed numpy-1.15.2 scikit-learn-0.20.0 scipy-1.1.0
pi@raspberrypi001:~ $ pip3 install matplotlib
Collecting matplotlib
Downloading https://www.piwheels.org/simple/matplotlib/matplotlib-3.0.0-cp35-cp35m-linux_armv7l.whl (10.7MB)
100% |████████████████████████████████| 10.7MB 23kB/s
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/2b/4a/f06b45ab9690d4c37641ec776f7ad691974f4cf6943a73267475b05cbfca/pyparsing-2.2.2-py2.py3-none-any.whl (57kB)
100% |████████████████████████████████| 61kB 1.3MB/s
Collecting python-dateutil>=2.1 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
100% |████████████████████████████████| 215kB 1.1MB/s
Collecting numpy>=1.10.0 (from matplotlib)
Using cached https://www.piwheels.org/simple/numpy/numpy-1.15.2-cp35-cp35m-linux_armv7l.whl
Collecting kiwisolver>=1.0.1 (from matplotlib)
Downloading https://www.piwheels.org/simple/kiwisolver/kiwisolver-1.0.1-cp35-cp35m-linux_armv7l.whl (905kB)
100% |████████████████████████████████| 911kB 170kB/s
Collecting cycler>=0.10 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil>=2.1->matplotlib)
Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting setuptools (from kiwisolver>=1.0.1->matplotlib)
Downloading https://files.pythonhosted.org/packages/96/06/c8ee69628191285ddddffb277bd5abdf769166e7a14b867c2a172f0175b1/setuptools-40.4.3-py2.py3-none-any.whl (569kB)
100% |████████████████████████████████| 573kB 417kB/s
Installing collected packages: pyparsing, six, python-dateutil, numpy, setuptools, kiwisolver, cycler, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.0.1 matplotlib-3.0.0 numpy-1.15.2 pyparsing-2.2.2 python-dateutil-2.7.3 setuptools-40.4.3 six-1.11.0
pi@raspberrypi001:~ $ pip3 install keras
Collecting keras
Downloading https://files.pythonhosted.org/packages/5e/10/aa32dad071ce52b5502266b5c659451cfd6ffcbf14e6c8c4f16c0ff5aaab/Keras-2.2.4-py2.py3-none-any.whl (312kB)
100% |████████████████████████████████| 317kB 689kB/s
Collecting six>=1.9.0 (from keras)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.9.1 (from keras)
Using cached https://www.piwheels.org/simple/numpy/numpy-1.15.2-cp35-cp35m-linux_armv7l.whl
Collecting pyyaml (from keras)
Downloading https://www.piwheels.org/simple/pyyaml/PyYAML-3.13-cp35-cp35m-linux_armv7l.whl (42kB)
100% |████████████████████████████████| 51kB 97kB/s
Collecting keras-applications>=1.0.6 (from keras)
Downloading https://files.pythonhosted.org/packages/3f/c4/2ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b/Keras_Applications-1.0.6-py2.py3-none-any.whl (44kB)
100% |████████████████████████████████| 51kB 876kB/s
Collecting scipy>=0.14 (from keras)
Using cached https://www.piwheels.org/simple/scipy/scipy-1.1.0-cp35-cp35m-linux_armv7l.whl
Collecting keras-preprocessing>=1.0.5 (from keras)
Downloading https://files.pythonhosted.org/packages/fc/94/74e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69/Keras_Preprocessing-1.0.5-py2.py3-none-any.whl
Collecting h5py (from keras)
Downloading https://www.piwheels.org/simple/h5py/h5py-2.8.0-cp35-cp35m-linux_armv7l.whl (3.6MB)
100% |████████████████████████████████| 3.6MB 65kB/s
Installing collected packages: six, numpy, pyyaml, h5py, keras-applications, scipy, keras-preprocessing, keras
Successfully installed h5py-2.8.0 keras-2.2.4 keras-applications-1.0.6 keras-preprocessing-1.0.5 numpy-1.15.2 pyyaml-3.13 scipy-1.1.0 six-1.11.0
pi@raspberrypi001:~ $ pip3 install theano
Collecting theano
Downloading https://www.piwheels.org/simple/theano/Theano-1.0.3-py3-none-any.whl (2.7MB)
100% |████████████████████████████████| 2.7MB 99kB/s
Collecting numpy>=1.9.1 (from theano)
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
pi@raspberrypi001:~ $ ```
>
>
> ^C
pi@raspberrypi001:~ $ pip3 install theano
Collecting theano
Using cached https://www.piwheels.org/simple/theano/Theano-1.0.3-py3-none-any.whl
Collecting scipy>=0.14 (from theano)
Using cached https://www.piwheels.org/simple/scipy/scipy-1.1.0-cp35-cp35m-linux_armv7l.whl
Collecting six>=1.9.0 (from theano)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.9.1 (from theano)
Using cached https://www.piwheels.org/simple/numpy/numpy-1.15.2-cp35-cp35m-linux_armv7l.whl
Installing collected packages: numpy, scipy, six, theano
Successfully installed numpy-1.15.2 scipy-1.1.0 six-1.11.0 theano-1.0.3
pi@raspberrypi001:~ $ python ml-03-01-version.py
scikit-learnはインストールされていません
numpyのバージョンは1.12.1です
scypyはインストールされていません
matplotlibはインストールされていません
PIL(Pillow)のバージョンは4.0.0です
kerasがインストールされていないか、まだ設定が済んでいません
theanoはインストールされていません
pi@raspberrypi001:~ $ python3 ml-03-01-version.py
scikit-learnはインストールされていません
numpyはインストールされていません
scypyはインストールされていません
matplotlibはインストールされていません
PIL(Pillow)のバージョンは4.0.0です
kerasがインストールされていないか、まだ設定が済んでいません
theanoはインストールされていません
pi@raspberrypi001:~ $ ls
Desktop ml-06-08-svc-gui.py ml-10-06-digits-cnn-gui-mod.py
Documents ml-06-09-nn-gui.py ml-10-07-hand-cnn-learn.py
Downloads ml-06-10-svc-gui-mod.py ml-10-08-hand-cnn-load.py
MagPi ml-06-11-nn-gui-mod.py ml-10-09-janken-deep.py
ml-03-01-version.py ml-07-01-janken-cui.py ml-10-10-janken-deep-shorten.py
ml-04-01-irisbasic.py ml-07-02-perceptron-cui.py mlbb-sample.zip
ml-04-02-2feat2class01.py ml-07-03-janken-gui.py ml-digits-cnn.h5
ml-04-03-2feat2class12.py ml-07-04-perceptron-gui.py ml-hand-cnn.h5
ml-04-04-2feat3class.py ml-08-01-cameracheck.py ml-images
ml-04-05-4feat3class.py ml-08-02-binary.py ml-iris-deep.h5
ml-05-01-2feat3class-nn.py ml-08-03-learn.py ml-learn
ml-05-02-4feat3class-nn.py ml-08-04-recognition.py ml-sound
ml-06-01-digitsbasic.py ml-09-01-janken.py Music
ml-06-02-images.py ml-09-02-janken-shorten.py Pictures
ml-06-03-plot3d.py ml-10-01-iris-deep-learn.py Public
ml-06-04-svc.py ml-10-02-iris-deep-load.py python_games
ml-06-05-nn.py ml-10-03-digits-cnn-learn.py Templates
ml-06-06-svc-traintest.py ml-10-04-digits-cnn-load.py Videos
ml-06-07-nn-traintest.py ml-10-05-digits-cnn-gui.py work
pi@raspberrypi001:~ $ python3 ml-04-01-irisbasic.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ml-04-01-irisbasic.py", line 2, in <module>
from sklearn import datasets
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/__init__.py", line 64, in <module>
from .base import clone
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/base.py", line 10, in <module>
import numpy as np
File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/pi/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

pi@raspberrypi001:~ $ python3 ml-04-02-2feat2class01.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ml-04-02-2feat2class01.py", line 2, in <module>
from sklearn import datasets, svm
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/__init__.py", line 64, in <module>
from .base import clone
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/base.py", line 10, in <module>
import numpy as np
File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/pi/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

pi@raspberrypi001:~ $ pip update python
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
pi@raspberrypi001:~ $ pip3 update python
ERROR: unknown command "update"
pi@raspberrypi001:~ $ pip3 install python3
Collecting python3
Downloading https://www.piwheels.org/simple/python3/python3-0.1-py3-none-any.whl
Installing collected packages: python3
Successfully installed python3-0.1
pi@raspberrypi001:~ $ python3 ml-03-01-version.py
scikit-learnはインストールされていません
numpyはインストールされていません
scypyはインストールされていません
matplotlibはインストールされていません
PIL(Pillow)のバージョンは4.0.0です
kerasがインストールされていないか、まだ設定が済んでいません
theanoはインストールされていません
pi@raspberrypi001:~ $ ls ml+
ls: cannot access 'ml+': No such file or directory
pi@raspberrypi001:~ $ ls ml*
ml-03-01-version.py ml-06-08-svc-gui.py ml-10-02-iris-deep-load.py
ml-04-01-irisbasic.py ml-06-09-nn-gui.py ml-10-03-digits-cnn-learn.py
ml-04-02-2feat2class01.py ml-06-10-svc-gui-mod.py ml-10-04-digits-cnn-load.py
ml-04-03-2feat2class12.py ml-06-11-nn-gui-mod.py ml-10-05-digits-cnn-gui.py
ml-04-04-2feat3class.py ml-07-01-janken-cui.py ml-10-06-digits-cnn-gui-mod.py
ml-04-05-4feat3class.py ml-07-02-perceptron-cui.py ml-10-07-hand-cnn-learn.py
ml-05-01-2feat3class-nn.py ml-07-03-janken-gui.py ml-10-08-hand-cnn-load.py
ml-05-02-4feat3class-nn.py ml-07-04-perceptron-gui.py ml-10-09-janken-deep.py
ml-06-01-digitsbasic.py ml-08-01-cameracheck.py ml-10-10-janken-deep-shorten.py
ml-06-02-images.py ml-08-02-binary.py mlbb-sample.zip
ml-06-03-plot3d.py ml-08-03-learn.py ml-digits-cnn.h5
ml-06-04-svc.py ml-08-04-recognition.py ml-hand-cnn.h5
ml-06-05-nn.py ml-09-01-janken.py ml-iris-deep.h5
ml-06-06-svc-traintest.py ml-09-02-janken-shorten.py
ml-06-07-nn-traintest.py ml-10-01-iris-deep-learn.py

ml-images:
comp_choki.png comp_gu.png comp_pa.png human_choki.png human_gu.png human_pa.png

ml-learn:
img_choki000.png img_choki008.png img_gu001.png img_gu009.png img_pa002.png img_pa010.png
img_choki001.png img_choki009.png img_gu002.png img_gu010.png img_pa003.png img_pa011.png
img_choki002.png img_choki010.png img_gu003.png img_gu011.png img_pa004.png img_pa012.png
img_choki003.png img_choki011.png img_gu004.png img_gu012.png img_pa005.png img_pa013.png
img_choki004.png img_choki012.png img_gu005.png img_gu013.png img_pa006.png img_pa014.png
img_choki005.png img_choki013.png img_gu006.png img_gu014.png img_pa007.png
img_choki006.png img_choki014.png img_gu007.png img_pa000.png img_pa008.png
img_choki007.png img_gu000.png img_gu008.png img_pa001.png img_pa009.png

ml-sound:
jankenpon.mp3 pon.mp3 README.txt
pi@raspberrypi001:~ $ pwd
/home/pi
pi@raspberrypi001:~ $ ls
Desktop ml-06-08-svc-gui.py ml-10-06-digits-cnn-gui-mod.py
Documents ml-06-09-nn-gui.py ml-10-07-hand-cnn-learn.py
Downloads ml-06-10-svc-gui-mod.py ml-10-08-hand-cnn-load.py
MagPi ml-06-11-nn-gui-mod.py ml-10-09-janken-deep.py
ml-03-01-version.py ml-07-01-janken-cui.py ml-10-10-janken-deep-shorten.py
ml-04-01-irisbasic.py ml-07-02-perceptron-cui.py mlbb-sample.zip
ml-04-02-2feat2class01.py ml-07-03-janken-gui.py ml-digits-cnn.h5
ml-04-03-2feat2class12.py ml-07-04-perceptron-gui.py ml-hand-cnn.h5
ml-04-04-2feat3class.py ml-08-01-cameracheck.py ml-images
ml-04-05-4feat3class.py ml-08-02-binary.py ml-iris-deep.h5
ml-05-01-2feat3class-nn.py ml-08-03-learn.py ml-learn
ml-05-02-4feat3class-nn.py ml-08-04-recognition.py ml-sound
ml-06-01-digitsbasic.py ml-09-01-janken.py Music
ml-06-02-images.py ml-09-02-janken-shorten.py Pictures
ml-06-03-plot3d.py ml-10-01-iris-deep-learn.py Public
ml-06-04-svc.py ml-10-02-iris-deep-load.py python_games
ml-06-05-nn.py ml-10-03-digits-cnn-learn.py Templates
ml-06-06-svc-traintest.py ml-10-04-digits-cnn-load.py Videos
ml-06-07-nn-traintest.py ml-10-05-digits-cnn-gui.py work
pi@raspberrypi001:~ $ cat ml-03-01-version.py
# -*- coding: utf-8 -*-

try:
import sklearn
sklearnExists = True
except ImportError:
sklearnExists = False

try:
import numpy
numpyExists = True
except ImportError:
numpyExists = False

try:
import scipy
scipyExists = True
except ImportError:
scipyExists = False

try:
import matplotlib
matplotlibExists = True
except ImportError:
matplotlibExists = False

try:
from PIL import Image
PILExists = True
except ImportError:
PILExists = False

try:
import keras
kerasExists = True
except ImportError:
kerasExists = False

try:
import theano
theanoExists = True
except ImportError:
theanoExists = False

if sklearnExists == True:
print('scikit-learnのバージョンは{0}です'.format(sklearn.__version__))
else:
print('scikit-learnはインストールされていません')

if numpyExists == True:
print('numpyのバージョンは{0}です'.format(numpy.__version__))
else:
print('numpyはインストールされていません')

if scipyExists == True:
print('scipyのバージョンは{0}です'.format(scipy.__version__))
else:
print('scypyはインストールされていません')

if matplotlibExists == True:
print('matplotlibのバージョンは{0}です'.format(matplotlib.__version__))
else:
print('matplotlibはインストールされていません')

if PILExists == True:
print('PIL(Pillow)のバージョンは{0}です'.format(Image.PILLOW_VERSION))
else:
print('PIL(Pillow)はインストールされていません')

if kerasExists == True:
print('kerasのバージョンは{0}です'.format(keras.__version__))
else:
print('kerasがインストールされていないか、まだ設定が済んでいません')

if theanoExists == True:
print('theanoのバージョンは{0}です'.format(theano.__version__))
else:
print('theanoはインストールされていません')

pi@raspberrypi001:~ $ pip3 install sklearn
Collecting sklearn
Downloading https://www.piwheels.org/simple/sklearn/sklearn-0.0-py2.py3-none-any.whl
Collecting scikit-learn (from sklearn)
Using cached https://www.piwheels.org/simple/scikit-learn/scikit_learn-0.20.0-cp35-cp35m-linux_armv7l.whl
Collecting scipy>=0.13.3 (from scikit-learn->sklearn)
Using cached https://www.piwheels.org/simple/scipy/scipy-1.1.0-cp35-cp35m-linux_armv7l.whl
Collecting numpy>=1.8.2 (from scikit-learn->sklearn)
Using cached https://www.piwheels.org/simple/numpy/numpy-1.15.2-cp35-cp35m-linux_armv7l.whl
Installing collected packages: numpy, scipy, scikit-learn, sklearn
Successfully installed numpy-1.15.2 scikit-learn-0.20.0 scipy-1.1.0 sklearn-0.0
pi@raspberrypi001:~ $ python3 ml-03-01-version.py
scikit-learnはインストールされていません
numpyはインストールされていません
scypyはインストールされていません
matplotlibはインストールされていません
PIL(Pillow)のバージョンは4.0.0です
kerasがインストールされていないか、まだ設定が済んでいません
theanoはインストールされていません
pi@raspberrypi001:~ $ python3 ml-04-02-2feat2class01.py
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "ml-04-02-2feat2class01.py", line 2, in <module>
from sklearn import datasets, svm
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/__init__.py", line 64, in <module>
from .base import clone
File "/home/pi/.local/lib/python3.5/site-packages/sklearn/base.py", line 10, in <module>
import numpy as np
File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/pi/.local/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/home/pi/.local/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

pi@raspberrypi001:~ $ apt-get install anaconda

E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
pi@raspberrypi001:~ $ sudo apt-get install anaconda
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package anaconda


docker

pi@raspberrypi001:~ $ sudo apt-get install curl

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libcurl3
The following packages will be upgraded:
curl libcurl3
2 upgraded, 0 newly installed, 0 to remove and 104 not upgraded.
Need to get 480 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf curl armhf 7.52.1-5+deb9u7 [220 kB]
Get:2 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian stretch/main armhf libcurl3 armhf 7.52.1-5+deb9u7 [260 kB]
Fetched 480 kB in 1s (266 kB/s)
Reading changelogs... Done
(Reading database ... 115486 files and directories currently installed.)
Preparing to unpack .../curl_7.52.1-5+deb9u7_armhf.deb ...
Unpacking curl (7.52.1-5+deb9u7) over (7.52.1-5+deb9u6) ...
Preparing to unpack .../libcurl3_7.52.1-5+deb9u7_armhf.deb ...
Unpacking libcurl3:armhf (7.52.1-5+deb9u7) over (7.52.1-5+deb9u6) ...
Setting up libcurl3:armhf (7.52.1-5+deb9u7) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up curl (7.52.1-5+deb9u7) ...
pi@raspberrypi001:~ $ curl -sSL https://get.docker.com | sh
# Executing docker install script, commit: 36b78b2
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sudo -E sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sudo -E sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian stretch edge" > /etc/apt/sources.list.d/docker.list
+ [ raspbian = debian ]
+ sudo -E sh -c apt-get update -qq >/dev/null
+ sudo -E sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sudo -E sh -c docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:30:52 2018
OS/Arch: linux/arm
Experimental: false

Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:26:37 2018
OS/Arch: linux/arm
Experimental: false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

sudo usermod -aG docker pi

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
pi@raspberrypi001:~ $

pi@raspberrypi001:~ $   sudo usermod -aG docker pi

pi@raspberrypi001:~ $ sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
pi@raspberrypi001:~ $ sudo systemctl start docker
pi@raspberrypi001:~ $ docker run -ti arm32v6/alpine:3.5 /bin/sh
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
$ reboot


after reboot

pi@raspberrypi001:~ $ docker run -ti arm32v6/alpine:3.5 /bin/sh

Unable to find image 'arm32v6/alpine:3.5' locally
3.5: Pulling from arm32v6/alpine
355842f7aa77: Pull complete
559bc1020041: Pull complete
Digest: sha256:5fcf00d09906e2ab2df5f421d066d992b44dc7690702b0abea7fd0dc0e130f72
Status: Downloaded newer image for arm32v6/alpine:3.5
/ # wget http://bluebacks.kodansha.co.jp/books/9784065020524/appendix/attachmen
ts/mlbb-sample.zip
Connecting to bluebacks.kodansha.co.jp (143.204.126.154:80)
mlbb-sample.zip 100% |*******************************| 3168k 0:00:00 ETA
/ # apt-get install unzip
/bin/sh: apt-get: not found
/ # ls
bin media run usr
dev mlbb-sample.zip sbin var
etc mnt srv
home proc sys
lib root tmp
/ # exit


pi@raspberrypi001:~ $ sudo docker run -ti --privileged resin/rpi-raspbian:jessie /bin/bash
Unable to find image 'resin/rpi-raspbian:jessie' locally
jessie: Pulling from resin/rpi-raspbian
64a8e2aece70: Downloading 27.7MB/51.5MB
6ef9f21e8452: Download complete
a0399e6bf91b: Download complete
9bc53db43ebc: Download complete
6d45580ca481: Download complete
6772dffd392e: Download complete
8251645e365d: Download complete
bc999b69c15a: Download complete
d52d412b41c7: Download complete
102656bd0a77: Download complete
283ca90f49b3: Download complete

^C
pi@raspberrypi001:~ $ sudo docker run -ti --privileged resin/rpi-raspbian:latest /bin/bash
Unable to find image 'resin/rpi-raspbian:latest' locally
latest: Pulling from resin/rpi-raspbian
64a8e2aece70: Downloading 20.4MB/51.5MB
6ef9f21e8452: Download complete
a0399e6bf91b: Download complete
9bc53db43ebc: Download complete
6d45580ca481: Download complete
6772dffd392e: Download complete
8251645e365d: Download complete
bc999b69c15a: Download complete
d52d412b41c7: Download complete
102656bd0a77: Download complete
283ca90f49b3: Download complete

#参考文献(reference)

RaspberryPiでcondaを使いたいしpython3.6も使いたい
https://qiita.com/saragai/items/52de118c1aef1efeb284

## docker
DOCKER COMES TO RASPBERRY PI
https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/
Raspberry PiにDockerを入れる
https://qiita.com/saragai/items/52de118c1aef1efeb284

Docker on Raspberry PiのインストールとLチカ
https://qiita.com/ykshr/items/c78eb72e3ee75664a5fe

RaspberryPi3(ラズパイ)にDockerでPython+bottle+MySQL環境構築する!【簡単構築編】
https://qiita.com/RyosukeKamei/items/3c79b9f3c489908a529c

Raspberry Pi 3 Model B(Raspbian)にDockerをインストールする
https://qiita.com/yuyakato/items/1cdc7fa511f7767c95ac