CentOSのサーバへpipでaws-cliを入れようとしたら、下記のようなエラーが出た。
$ pip install aws
Collecting aws
Downloading aws-0.2.5.tar.gz
...snip...
No package 'libffi' found
c/_cffi_backend.c:2:20: 致命的エラー: Python.h: そのようなファイルやディレクトリはありません
#include <Python.h>
^
コンパイルを停止しました。
...snip...
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
build/temp.linux-x86_64-2.7/_openssl.c:12:24: 致命的エラー: pyconfig.h: そのようなファイルやディレクトリはありません
# include <pyconfig.h>
^
コンパイルを停止しました。
error: command 'gcc' failed with exit status 1
awsコマンドの依存パッケージが足りないから追加インストールしようとしたけど、Python.h, pyconfig.hが無くてコンパイルに失敗している模様
パッケージインストール中に出る○○が無い系のエラーは、単純に足りないパッケージをインストールしてあげれば機嫌が治るはず
今回は名前からして、いかにもpythonのヘッダファイルが足りないっぽいので python-devel をインストールしてみる
$ sudo yum install python-devel
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ python-devel.x86_64 0:2.7.5-48.el7 を インストール
--> 依存性解決を終了しました。
依存性を解決しました
======================================================================================================================
Package アーキテクチャー バージョン リポジトリー 容量
======================================================================================================================
インストール中:
python-devel x86_64 2.7.5-48.el7 base 393 k
トランザクションの要約
======================================================================================================================
インストール 1 パッケージ
総ダウンロード容量: 393 k
インストール容量: 1.0 M
Is this ok [y/d/N]: y
Downloading packages:
python-devel-2.7.5-48.el7.x86_64.rpm | 393 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : python-devel-2.7.5-48.el7.x86_64 1/1
検証中 : python-devel-2.7.5-48.el7.x86_64 1/1
インストール:
python-devel.x86_64 0:2.7.5-48.el7
完了しました!
いざ、リトライ
$ pip install aws
Collecting aws
...snip...
Successfully built cryptography
Installing collected packages: prettytable, cryptography, paramiko, fabric, aws
Successfully installed aws-0.2.5 cryptography-1.7.2 fabric-1.13.1 paramiko-2.1.2 prettytable-0.7.2
今度はちゃんとコンパイル通ったっぽい
$ aws --version
aws-cli/1.11.82 Python/2.7.5 Linux/3.10.0-514.16.1.el7.x86_64 botocore/1.5.45
わーい、入った