【发布时间】:2018-02-25 16:07:07
【问题描述】:
我正在尝试为先知运行一个教程,该教程在 Jupyter 笔记本中使用 R 魔法。以下代码:
%%R
library(prophet)
df <- read.csv('../examples/example_wp_peyton_manning.csv')
df$y <- log(df$y)
m <- prophet(df)
future <- make_future_dataframe(m, periods=366)
返回这个:
Error in library(prophet) : there is no package called ‘prophet’
然后,在我的 iPython 笔记本中运行:
from rpy2.robjects.packages import importr
utils = importr('utils')
utils.install_packages('prophet')
返回这个:
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors
1: 0-Cloud [https] 2: Australia (Canberra) [https]
3: Australia (Melbourne) [https] 4: Australia (Perth) [https]
5: Austria [https] 6: Belgium (Ghent) [https]
7: Brazil (RJ) [https] 8: Brazil (SP 1) [https]
9: Bulgaria [https] 10: Chile 1 [https]
11: China (Lanzhou) [https] 12: Colombia (Cali) [https]
13: Czech Republic [https] 14: Denmark [https]
15: France (Lyon 1) [https] 16: France (Lyon 2) [https]
17: France (Marseille) [https] 18: France (Montpellier) [https]
19: France (Paris 2) [https] 20: Germany (Münster) [https]
21: Iceland [https] 22: Indonesia (Jakarta) [https]
23: Ireland [https] 24: Italy (Padua) [https]
25: Japan (Tokyo) [https] 26: Malaysia [https]
27: Mexico (Mexico City) [https] 28: Norway [https]
29: Philippines [https] 30: Russia (Moscow) [https]
31: Spain (A Coruña) [https] 32: Spain (Madrid) [https]
33: Sweden [https] 34: Switzerland [https]
35: UK (Bristol) [https] 36: UK (Cambridge) [https]
37: UK (London 1) [https] 38: USA (CA 1) [https]
39: USA (KS) [https] 40: USA (MI 1) [https]
41: USA (TN) [https] 42: USA (TX 1) [https]
43: USA (TX 2) [https] 44: (other mirrors)
出现一个输入框,我所做的任何选择都会导致:
rpy2.rinterface.NULL
我有 RStudio,Prophet 在 R Studio 中运行没有问题。这告诉我,我在某个地方运行了另一个 R 内核,链接到 Anaconda 中的环境,或者其他一些配置错误。
有什么方法可以解决这个问题,以便我可以使用我在 R Studio 中的内核运行 R 或强制当前的 R 内核安装先知?
我如何知道这个 Jupyter notebook 中 R 魔法使用的 R 内核的位置?
我使用的是 Mac,我可能有一些交叉链接的文件等(我的 Jupyter 笔记本显示 6 个内核,而我真的有 3 个......它重复了我有两次)。
谢谢
【问题讨论】:
-
请不要使用 [prophet] 标签,除非您使用的是Prophet 软件。
标签: r macos jupyter-notebook rpy2