6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pip checkを実行すると、モジュール間の依存関係を確認できるという話

Last updated at Posted at 2018-10-11

実現したかったこと

Microsoft azureをSDKで起動し、Azure仮想マシン(=VM)の作成までを完全にPythonコードのみで実現したかった。

手順

そのため、Azure SDK for PythonをGithubのガイドにしたがってインストールし、手順については公式ドキュメントの手順通りにスクリプトを作成した。

そしてpythonスクリプトを実行したが、結果エラーが出力された。
エラー内容は以下リンク内容と同様で'ImportError: No module named 'msrest'などのインポートエラーが出力する。

原因

インストールするモジュールの依存性だった。

処置

不要な(依存性を満たさない)モジュールを、pip uninstallでアンインストールし、
その後、必要なモジュールをpip install で再インストールして実行すると無事に起動した。

詳細

不要なモジュールを検知する(=依存性を確認する)コマンドとして、
pip check の存在を知った。

pip check での確認OK,NGの場合のターミナル上の出力は以下となる。

OK
$ pip check
No broken requirements found.
$ echo $?
0
NG
$ pip check
pyramid 1.5.2 has requirement WebOb>=1.3.1, but you have WebOb 0.8.
$ echo $?
1

②動かないソースは、githubにあるazure sdk for pythonの手順なので、この記事にたどり着いた方は、気をつけて下さい。原因は依存性です。

6
1
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
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?