Translate

2019年7月31日水曜日

pip install時にERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.というエラーが発生する

pip install時にERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.というエラーが発生する

Raspberry Pi上で以下のようにtensorflowをpip install しようとしたら、

(env) pi@nakano:/dev/input $ pip install tensorflow
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tensorflow
  Downloading https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl (87.1MB)
     |??????                          | 13.9MB 36kB/s eta 0:33:37

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    tensorflow from https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl#sha256=25f4ff027beec1e568baf8e90a07bad59d354560533d6b37318b9efeb70beeb1:
        Expected sha256 25f4ff027beec1e568baf8e90a07bad59d354560533d6b37318b9efeb70beeb1
             Got        3ace76e2b0ded895a4e6239a4620a1f0aaa92ad8747d5660f6b34f17d5f4c688

というエラーが出てしまい先に進めない..

--no-chache-dirをつけて実行しても同様のエラーでとまる。

ダウンロードしようとしてフィンガープリントのハッシュが合わないようなので、以下のようにwgetしてwhlファイルをpip innstallしたら..何度かエラーを出すがそのままダウンロードすることができ、うまくいった。

env) pi@nakano:~/tmp $ wget https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
--2019-07-31 00:03:14--  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Resolving www.piwheels.org (www.piwheels.org)... 93.93.129.174, 46.235.225.189, 2a00:1098:0:82:1000:3b:1:1, ...
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 87138952 (83M)
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c  16%[== >                  ]  13.39M  29.1KB/s    in 8m 16s

2019-07-31 00:11:35 (27.6 KB/s) - Read error at byte 14041088/87138952 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 00:11:36--  (try: 2)  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 87138952 (83M), 73097864 (70M) remaining
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c  34%[+++== >               ]  28.31M  27.8KB/s    in 9m 11s

2019-07-31 00:20:51 (27.7 KB/s) - Read error at byte 29687808/87138952 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 00:20:53--  (try: 3)  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 87138952 (83M), 57451144 (55M) remaining
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c  51%[++++++=== >           ]  43.02M  30.3KB/s    in 8m 56s

2019-07-31 00:29:52 (28.1 KB/s) - Read error at byte 45105152/87138952 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 00:29:55--  (try: 4)  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 87138952 (83M), 42033800 (40M) remaining
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c  68%[++++++++++== >        ]  56.80M  27.9KB/s    in 8m 22s

2019-07-31 00:38:21 (28.1 KB/s) - Read error at byte 59555840/87138952 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 00:38:25--  (try: 5)  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 87138952 (83M), 27583112 (26M) remaining
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c  84%[+++++++++++++== >     ]  70.11M  27.2KB/s    in 8m 7s

2019-07-31 00:46:36 (28.0 KB/s) - Read error at byte 73515008/87138952 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 00:46:41--  (try: 6)  https://www.piwheels.org/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|93.93.129.174|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 87138952 (83M), 13623944 (13M) remaining
Saving to: ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’

tensorflow-1.13.1-c 100%[++++++++++++++++=== > ]  83.10M  28.1KB/s    in 7m 56s

2019-07-31 00:54:39 (28.0 KB/s) - ‘tensorflow-1.13.1-cp37-none-linux_armv6l.whl’ saved [87138952/87138952]

(env) pi@nakano:~/tmp $ ls
tensorflow-1.13.1-cp37-none-linux_armv6l.whl
(env) pi@nakano:~/tmp $ pip install tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Collecting termcolor > =1.1.0 (from tensorflow==1.13.1)
  Downloading https://www.piwheels.org/simple/termcolor/termcolor-1.1.0-py3-none-any.whl
Collecting absl-py > =0.7.0 (from tensorflow==1.13.1)
  Downloading https://www.piwheels.org/simple/absl-py/absl_py-0.7.1-py3-none-any.whl (117kB)
     |????????????????????????????????| 122kB 52kB/s
Collecting tensorflow-estimator < 1.15.0rc0, > =1.14.0rc0 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/3c/d5/21860a5b11caf0678fbc8319341b0ae21a07156911132e0e71bffed0510d/tensorflow_estimator-1.14.0-py2.py3-none-any.whl (488kB)
     |????????????????????????????????| 491kB 21kB/s
Collecting astor > =0.6.0 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/d1/4f/950dfae467b384fc96bc6469de25d832534f6b4441033c39f914efd13418/astor-0.8.0-py2.py3-none-any.whl
Collecting google-pasta > =0.1.6 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/d0/33/376510eb8d6246f3c30545f416b2263eee461e40940c2a4413c711bdf62d/google_pasta-0.1.7-py3-none-any.whl (52kB)
     |????????????????????????????????| 61kB 56kB/s
Collecting wrapt > =1.11.1 (from tensorflow==1.13.1)
  Downloading https://www.piwheels.org/simple/wrapt/wrapt-1.11.2-cp37-cp37m-linux_armv6l.whl (68kB)
     |????????????????????????????????| 71kB 51kB/s
Requirement already satisfied: six > =1.10.0 in /usr/lib/python3/dist-packages (from tensorflow==1.13.1) (1.12.0)
Requirement already satisfied: wheel > =0.26 in /home/pi/env/lib/python3.7/site-packages (from tensorflow==1.13.1) (0.33.4)
Requirement already satisfied: numpy < 2.0, > =1.14.5 in /usr/lib/python3/dist-packages (from tensorflow==1.13.1) (1.16.2)
Collecting keras-applications > =1.0.8 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl (50kB)
     |????????????????????????????????| 51kB 30kB/s
Collecting tensorboard < 1.14.0, > =1.13.0 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/0f/39/bdd75b08a6fba41f098b6cb091b9e8c7a80e1b4d679a581a0ccd17b10373/tensorboard-1.13.1-py3-none-any.whl (3.2MB)
     |????????????????????????????????| 3.2MB 24kB/s
Collecting grpcio > =1.8.6 (from tensorflow==1.13.1)
  Downloading https://www.piwheels.org/simple/grpcio/grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl (13.0MB)
     |???????????????????????????     | 10.7MB 27kB/s eta 0:01:25
Collecting keras-preprocessing > =1.0.5 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41kB)
     |????????????????????????????????| 51kB 36kB/s
Collecting gast > =0.2.0 (from tensorflow==1.13.1)
  Downloading https://www.piwheels.org/simple/gast/gast-0.2.2-py3-none-any.whl
Collecting protobuf > =3.6.1 (from tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/34/58/a8230dcd36e5db75c1084f4fc32b18cc217bb2806143597df625dc628a5d/protobuf-3.9.0-py2.py3-none-any.whl (432kB)
     |????????????????????????????????| 440kB 29kB/s
Requirement already satisfied: h5py in /home/pi/env/lib/python3.7/site-packages (from keras-applications > =1.0.8- > tensorflow==1.13.1) (2.9.0)
Collecting markdown > =2.6.8 (from tensorboard < 1.14.0, > =1.13.0- > tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/c0/4e/fd492e91abdc2d2fcb70ef453064d980688762079397f779758e055f6575/Markdown-3.1.1-py2.py3-none-any.whl (87kB)
     |????????????????????????????????| 92kB 30kB/s
Collecting werkzeug > =0.11.15 (from tensorboard < 1.14.0, > =1.13.0- > tensorflow==1.13.1)
  Downloading https://files.pythonhosted.org/packages/d1/ab/d3bed6b92042622d24decc7aadc8877badf18aeca1571045840ad4956d3f/Werkzeug-0.15.5-py2.py3-none-any.whl (328kB)
     |????????????????????????????????| 337kB 26kB/s
Requirement already satisfied: setuptools in /home/pi/env/lib/python3.7/site-packages (from protobuf > =3.6.1- > tensorflow==1.13.1) (41.0.1)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    grpcio > =1.8.6 from https://www.piwheels.org/simple/grpcio/grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl#sha256=6f92b984a746341529b8f82f7c6e101d36d70764f232505949828af7dca27e06 (from tensorflow==1.13.1):
        Expected sha256 6f92b984a746341529b8f82f7c6e101d36d70764f232505949828af7dca27e06
             Got        e3c32a594668a3aa59f190f0a768e11b81710d91b1fa9ae2918d414ba204f2b5


(env) pi@nakano:~/tmp $ wget https://www.piwheels.org/simple/grpcio/grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
--2019-07-31 01:09:05--  https://www.piwheels.org/simple/grpcio/grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
Resolving www.piwheels.org (www.piwheels.org)... 46.235.225.189, 93.93.129.174, 2a00:1098:0:80:1000:3b:1:1, ...
Connecting to www.piwheels.org (www.piwheels.org)|46.235.225.189|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12990873 (12M)
Saving to: ‘grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl’

grpcio-1.22.0-cp37-  69%[============ >        ]   8.56M  26.5KB/s    in 5m 9s

2019-07-31 01:14:19 (28.4 KB/s) - Read error at byte 8978432/12990873 (Error decoding the received TLS packet.). Retrying.

--2019-07-31 01:14:20--  (try: 2)  https://www.piwheels.org/simple/grpcio/grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
Connecting to www.piwheels.org (www.piwheels.org)|46.235.225.189|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 12990873 (12M), 4012441 (3.8M) remaining
Saving to: ‘grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl’

grpcio-1.22.0-cp37- 100%[+++++++++++++====== > ]  12.39M  30.1KB/s    in 2m 20s

2019-07-31 01:16:42 (28.1 KB/s) - ‘grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl’ saved [12990873/12990873]

(env) pi@nakano:~/tmp $ ls
grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
tensorflow-1.13.1-cp37-none-linux_armv6l.whl
(env) pi@nakano:~/tmp $ pip install grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./grpcio-1.22.0-cp37-cp37m-linux_armv6l.whl
Requirement already satisfied: six > =1.5.2 in /usr/lib/python3/dist-packages (from grpcio==1.22.0) (1.12.0)
Installing collected packages: grpcio
Successfully installed grpcio-1.22.0
(env) pi@nakano:~/tmp $ pip install tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing ./tensorflow-1.13.1-cp37-none-linux_armv6l.whl
Collecting keras-applications > =1.0.8 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl
Requirement already satisfied: six > =1.10.0 in /usr/lib/python3/dist-packages (from tensorflow==1.13.1) (1.12.0)
Requirement already satisfied: numpy < 2.0, > =1.14.5 in /usr/lib/python3/dist-packages (from tensorflow==1.13.1) (1.16.2)
Collecting astor > =0.6.0 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/d1/4f/950dfae467b384fc96bc6469de25d832534f6b4441033c39f914efd13418/astor-0.8.0-py2.py3-none-any.whl
Collecting wrapt > =1.11.1 (from tensorflow==1.13.1)
  Using cached https://www.piwheels.org/simple/wrapt/wrapt-1.11.2-cp37-cp37m-linux_armv6l.whl
Collecting protobuf > =3.6.1 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/34/58/a8230dcd36e5db75c1084f4fc32b18cc217bb2806143597df625dc628a5d/protobuf-3.9.0-py2.py3-none-any.whl
Collecting gast > =0.2.0 (from tensorflow==1.13.1)
  Using cached https://www.piwheels.org/simple/gast/gast-0.2.2-py3-none-any.whl
Requirement already satisfied: grpcio > =1.8.6 in /home/pi/env/lib/python3.7/site-packages (from tensorflow==1.13.1) (1.22.0)
Collecting tensorflow-estimator < 1.15.0rc0, > =1.14.0rc0 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/3c/d5/21860a5b11caf0678fbc8319341b0ae21a07156911132e0e71bffed0510d/tensorflow_estimator-1.14.0-py2.py3-none-any.whl
Collecting tensorboard < 1.14.0, > =1.13.0 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/0f/39/bdd75b08a6fba41f098b6cb091b9e8c7a80e1b4d679a581a0ccd17b10373/tensorboard-1.13.1-py3-none-any.whl
Collecting termcolor > =1.1.0 (from tensorflow==1.13.1)
  Using cached https://www.piwheels.org/simple/termcolor/termcolor-1.1.0-py3-none-any.whl
Collecting absl-py > =0.7.0 (from tensorflow==1.13.1)
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/absl-py/
  Using cached https://www.piwheels.org/simple/absl-py/absl_py-0.7.1-py3-none-any.whl
Collecting google-pasta > =0.1.6 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/d0/33/376510eb8d6246f3c30545f416b2263eee461e40940c2a4413c711bdf62d/google_pasta-0.1.7-py3-none-any.whl
Collecting keras-preprocessing > =1.0.5 (from tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl
Requirement already satisfied: wheel > =0.26 in /home/pi/env/lib/python3.7/site-packages (from tensorflow==1.13.1) (0.33.4)
Requirement already satisfied: h5py in /home/pi/env/lib/python3.7/site-packages (from keras-applications > =1.0.8- > tensorflow==1.13.1) (2.9.0)
Requirement already satisfied: setuptools in /home/pi/env/lib/python3.7/site-packages (from protobuf > =3.6.1- > tensorflow==1.13.1) (41.0.1)
Collecting markdown > =2.6.8 (from tensorboard < 1.14.0, > =1.13.0- > tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/c0/4e/fd492e91abdc2d2fcb70ef453064d980688762079397f779758e055f6575/Markdown-3.1.1-py2.py3-none-any.whl
Collecting werkzeug > =0.11.15 (from tensorboard < 1.14.0, > =1.13.0- > tensorflow==1.13.1)
  Using cached https://files.pythonhosted.org/packages/d1/ab/d3bed6b92042622d24decc7aadc8877badf18aeca1571045840ad4956d3f/Werkzeug-0.15.5-py2.py3-none-any.whl
Installing collected packages: keras-applications, astor, wrapt, protobuf, gast, tensorflow-estimator, markdown, absl-py, werkzeug, tensorboard, termcolor, google-pasta, keras-preprocessing, tensorflow
Successfully installed absl-py-0.7.1 astor-0.8.0 gast-0.2.2 google-pasta-0.1.7 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.1.1 protobuf-3.9.0 tensorboard-1.13.1 tensorflow-1.13.1 tensorflow-estimator-1.14.0 termcolor-1.1.0 werkzeug-0.15.5 wrapt-1.11.2
(env) pi@nakano:~/tmp $ pip list


tensorboard          1.13.1
tensorflow           1.13.1
tensorflow-estimator 1.14.0


(env) pi@nakano:~/tmp $

関連パッケージも同様のエラーがでたのでwgetしてpip installして再実行してやっとこさtensorflowをインストールできた。

Raspberry Pi上だったのでLinuxコマンドのwgetを使ったが、WindowsならWSLのwgetcurlを使うか、ためしてないがブラウザでダウンロードしても多分動くはずだ。



..おかげで今月のギガ3GB全部使ってしまったよ..とほほ..

2019年7月30日火曜日

Raspbian OS 初回起動時からSSH接続したい




Raspbean OS をSDカードに書き込み、
Raspberry Piにさして最初に起動する際、
SSHが無効になっているので
どうしてもモニタやキーボードが必要になります。

Xを使う人はそれでもいいですが、
DonkeyCarやロボット、IoTゲートウェイとして
Xの入っていないRaspbean Liteをつかう人は
初回以外モニタなどは使用しない。

なので初回起動時からSSH接続したいはず。

とくにRaspberry Pi Zeroを使う場合
HDMIがミニHDMIコネクタでないと接続できない。

わざわざコネクタ買っても初回しか使わないし..

と、いうことで調べてみたら、
SDカードへイメージを書き込んだ直後、
SDカードカードのbootパーティション(wpa_supplicant.confと同じ場所)
に"ssh"という空のファイルを作成しておけば初回起動時にSSH接続できるようになるようだ。

情報元: http://downloads.raspberrypi.org/raspbian/release_notes.txt

sshというファイルを書き込んだSDカードをRaspberry Piに挿して
起動すると..うまくいった。デフォルトユーザでSSH経由でログインできた。

これは便利だ。

Raspberry Pi 4B(Raspbean buster lite) へ pyrealsense2 をインストールする

DonkeycarでIntel RealSense T265 トラッキングカメラを使おうと思ったのだけど、ドキュメントにUSB3.0推奨とある記述をみつけだ。 どうもUSB2.0でも動作するのだけど、イメージストリームを使う場合などは3.0のほうが良いのだろう。白黒の800...