5
2

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 3 years have passed since last update.

databricks notebook での !pipと%pip の違い

Posted at

Databricks notebookを使っててpipを使ったインストールなどで%pip install ... など出てくる。

あれ?!pip installじゃダメなの?と思って!pip installすると問題なく成功します。

念の為、何が違うのか調べてみました。

結論

  • !pip install: ドライバーノードにのみインストールされる。
  • %pip install: クラスター全体にインストールされる。

どういうことかというと、Databricksの場合Spark Cluster上でノートブックが実行されるため複数のサーバーが起動しております。

クラスターは全体を指揮するドライバーノードと実際の処理を実行するワーカーノードに分けられ、複数のワーカーノードが起動しております。なので!pipだとドライバーノードの1台しかインストールされないのです。

これからはデータブリックスでは**%pip**をこれからは利用しましょう!

5
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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?