R 包不会安装在 Jupyter Notebook 中,但会安装在 RStudio 和 R 应用程序中

标签 r jupyter-notebook r-package

我正在尝试在 Jupyter Notebook 中使用以下代码安装 PerformanceAnalytics 包,我已经使用它成功安装了许多包,例如 ggplot2,代码如下:

install.packages("PerformanceAnalytics", repos='http://cran.r-project.org')

但我读到了许多其他问题,添加 dependencies=TRUE 可以解决问题。不幸的是,它没有。我不断收到以下错误消息。

install.packages("PerformanceAnalytics", repos='http://cran.r-project.org', 
dependencies=TRUE)

Warning message in install.packages("PerformanceAnalytics", repos = 
"http://cran.r-project.org"): “installation of package ‘PerformanceAnalytics’ 
had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

该软件包在 R 应用程序和 RStudio 中安装没有问题。 Jupyter 需要这个特定的包,我缺少什么吗?我使用的是 macOS 10.12.5。以下是我运行 sessionInfo() 时的信息。

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin11.4.2 (64-bit)
Running under: macOS Sierra 10.12.5

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] R6_2.2.0        magrittr_1.5    IRdisplay_0.4.4 pbdZMQ_0.2-4   
 [5] tools_3.3.2     crayon_1.3.2    uuid_0.1-2      stringi_1.1.2  
 [9] IRkernel_0.7.1  jsonlite_1.1    stringr_1.1.0   digest_0.6.10  
[13] repr_0.10       evaluate_0.10  

最佳答案

Is it possible to install bioconductor package 'rain' in R Jupyter notebook? 问题的解决方案也解决了我的问题。我使用的是 Anaconda 的 R 版本。我卸载了 Anaconda,而是手动安装了 Jupyter Notebook 和 IRkernal,这解决了我的问题。有关完整详细信息,请参阅上述链接中的答案。

关于R 包不会安装在 Jupyter Notebook 中,但会安装在 RStudio 和 R 应用程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43300987/

相关文章:

r - 为什么 set.seed() 会影响 R 中的 sample()

r - 反序列化时出错(socklist[[n]]): error reading from connection on Unix

python - Jupyter 服务器无法启动

python - 在高级图表上设置 x 轴和 y 轴范围?

r - 无法从 GitHub 上的 R 包安装 vignette

r - 如何使用嵌套图加速 react 速度?

r - 如何标准化同一列中的混合日期格式

Julia DataFrame 输出函数

R CMD检查: Skip 'checking re-building of vignette outputs'

r - 无法安装 `proj4` 包,因为在标准搜索位置找不到 libproj 和/或 proj_api.h