LoginSignup
1
2

More than 3 years have passed since last update.

awscli のインストールにつまづきまくったまとめ

Posted at

pip3 install awscli --upgrade --user ができない(linux mint)

環境

OS: Linux Mint 19 (Tara)

解決策

1. apt で pip をインストールした場合は python を通して pip, setuptools をアップデート

root@bfdc53e293d1:/# apt install python3-pip
root@bfdc53e293d1:/# python3 -m pip install --upgrade pip setuptools
root@bfdc53e293d1:/# pip3 install awscli --upgrade --user

2. curl で pip をインストールした場合は問題なく awscli をインストールできる

root@5f09dd508f03:/# curl -kL https://bootstrap.pypa.io/get-pip.py | python3
root@5f09dd508f03:/# pip3 install awscli --upgrade --user

問題発生の過程

公式ページを参考に awscli をインストール

とりあえずコマンド実行

root@520b9056e621:/# pip3 install awscli --upgrade --user
bash: pip3: command not found
root@520b9056e621:/#

そもそもpip3を入れてなかったらしい

pip3をインストール

root@520b9056e621:/# apt install python3-pip -y
Reading package lists... Done
()
root@520b9056e621:/# pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
root@520b9056e621:/#

再度aws-cliをインストール(失敗)

root@520b9056e621:/# pip3 install awscli --upgrade --user
Collecting awscli
  Downloading https://files.pythonhosted.org/packages/3e/f6/ab0953739ca19152f52b2da153158989fc79200b297ebc2c35d3f41f614c/awscli-1.16.170.tar.gz (726kB)
    100% |████████████████████████████████| 727kB 844kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-a9u7oisq/awscli/
root@520b9056e621:/#

だめらしい。

ググって対処(pip・setuptools のアップデート)

参考ページ

root@520b9056e621:/# pip3 install --upgrade pip setuptools
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 639kB/s
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
    100% |████████████████████████████████| 583kB 1.0MB/s
Installing collected packages: pip, setuptools
  Found existing installation: pip 9.0.1
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-19.1.1 setuptools-41.0.1
root@520b9056e621:/#

今度こそインストール(失敗)

root@520b9056e621:/# pip3 install awscli --upgrade --user
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'
root@520b9056e621:/#

apt install したのに pip install --upgrade pip したら一元管理できてないじゃん。
参考ページ

結論

  • 最新のpip3をインストールする
  • ちゃんと一元管理する
  • そもそも curl で pip をインストールしていれば発生しなかった(公式読もう
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2