在 GCE 托管的 google colab Jupyter 笔记本上安装 R 包
Installing R packages on a GCE hosted google colab Jupyter notebook
我正在尝试在 colab 上安装 calendR 包。
我正在使用以下内容:
install.packages("calendR")
library(calendR)
但是错误如下:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘magick’, ‘ggimage’
Warning message in install.packages("calendR"):
“installation of package ‘magick’ had non-zero exit status”
Warning message in install.packages("calendR"):
“installation of package ‘ggimage’ had non-zero exit status”
Warning message in install.packages("calendR"):
“installation of package ‘calendR’ had non-zero exit status”
Error in library(calendR): there is no package called ‘calendR’
Traceback:
1. library(calendR)
有人知道如何安装吗?
默认内核
Google colab 默认使用 Python 3 Google Compute Engine 后端,基于 docker 容器,ubuntu 18.04。
它专为 python 设计并具有 ipython 内核。
但是,也安装了 R。
要安装 calendR
,请创建并 运行 具有以下内容的新单元格:
! add-apt-repository -y ppa:cran/imagemagick
! apt-get update
! apt-get install -y libmagick++-dev
! R -e "install.packages('calendR')"
这将执行 IPython 风格的 shell 命令。然后你可以在一个新的单元格中做这样的事情:
! R -e "library(calendR)"
红外内核
Colab 还可以托管其他内核,例如 R 的 ir。
然后,可以使用R命令执行shell命令:
system("add-apt-repository -y ppa:cran/imagemagick")
system("apt-get update")
system("apt-get install -y libmagick++-dev")
install.packages("calendR")
library("calendR")
我正在尝试在 colab 上安装 calendR 包。
我正在使用以下内容:
install.packages("calendR")
library(calendR)
但是错误如下:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘magick’, ‘ggimage’
Warning message in install.packages("calendR"):
“installation of package ‘magick’ had non-zero exit status”
Warning message in install.packages("calendR"):
“installation of package ‘ggimage’ had non-zero exit status”
Warning message in install.packages("calendR"):
“installation of package ‘calendR’ had non-zero exit status”
Error in library(calendR): there is no package called ‘calendR’
Traceback:
1. library(calendR)
有人知道如何安装吗?
默认内核
Google colab 默认使用 Python 3 Google Compute Engine 后端,基于 docker 容器,ubuntu 18.04。
它专为 python 设计并具有 ipython 内核。
但是,也安装了 R。
要安装 calendR
,请创建并 运行 具有以下内容的新单元格:
! add-apt-repository -y ppa:cran/imagemagick
! apt-get update
! apt-get install -y libmagick++-dev
! R -e "install.packages('calendR')"
这将执行 IPython 风格的 shell 命令。然后你可以在一个新的单元格中做这样的事情:
! R -e "library(calendR)"
红外内核
Colab 还可以托管其他内核,例如 R 的 ir。 然后,可以使用R命令执行shell命令:
system("add-apt-repository -y ppa:cran/imagemagick")
system("apt-get update")
system("apt-get install -y libmagick++-dev")
install.packages("calendR")
library("calendR")