DatabricksでRのProphetをインストールする際のエラーと対策


最近遭遇したので解決策をメモします。

現象

Databricksのクラスターライブラリとしてprophetをインストールしようとすると、以下のエラーでインストールできません。

java.lang.RuntimeException: Installation failed with message: 
Error installing R package: Could not install package with error:   installation of package 'V8' had non-zero exit status
  installation of package 'rstan' had non-zero exit status
  installation of package 'prophet' had non-zero exit status
Full error log available at /databricks/driver/library-install-logs/r-package-installation-2021-05-12T09:28:44Z-ue08v7_4.log

解決策

クラスターのinit scriptでV8をインストールします。その後、クラスターライブラリとしてProphetをインストールします。

Python

RのノートブックでPythonを実行しているので、%pythonマジックコマンドを指定しています。

%python
dbutils.fs.put("/databricks/scripts/v8-install.sh","""
sudo apt-get install -y libv8-dev""", True)

init scriptをクラスターに設定します。

クラスターライブラリとしてProphetをインストールします。

Databricks 無料トライアル

Databricks 無料トライアル