在 Azure ML Studio 上为 Microsoft R Open 3.4.4 安装 textshape 包
Installing textshape package for Microsoft R Open 3.4.4 on Azure ML Studio
我正在尝试在 Azure ML Studio 上使用 R sentimentr
包。由于不支持此软件包,我正在尝试按照 in the documentation.
中的说明安装它及其依赖项
我执行的步骤是:
- 的 R Open 3.4.4 快照下载 Windows 个二进制文件
sentimentr_2.2.3.zip
syuzhet_1.0.4.zip
textclean_0.6.3.zip
lexicon_0.7.4.zip
textshape_1.5.0.zip
将这些 zip 文件压缩到压缩文件夹中 packages.zip
- 已将
packages.zip
作为数据集上传到 Microsoft Azure ML Studio
在我的 ML 实验中,我将 packages.zip
数据集连接到 "Execute R Script" 上的 "Script Bundle (Zip)" 输入端口并包含此代码:
# install R package contained in src
install.packages("src/lexicon_0.7.4.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/textclean_0.6.3.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/textshape_1.5.0.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/syuzhet_1.0.4.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/sentimentr_2.2.3.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
# load libraries
library(sentimentr, lib.loc = ".", verbose = TRUE)
实验运行成功,直到我包含来自 sentimentr
:
的函数
mydata <- mydata %>%
get_sentences() %>%
sentiment()
这给出了错误:
there is no package called 'textshape'
这很难理解,因为输出日志并未表明包存在问题:
[Information] The following files have been unzipped for sourcing in path=["src"]:
[Information] Name Length Date
[Information] 1 sentimentr_2.2.3.zip 3366245 2019-08-07 14:57:00
[Information] 2 syuzhet_1.0.4.zip 2918474 2019-08-07 15:05:00
[Information] 3 textclean_0.6.3.zip 1154814 2019-08-07 15:13:00
[Information] 4 lexicon_0.7.4.zip 4551995 2019-08-07 15:17:00
[Information] 5 textshape_1.5.0.zip 463095 2019-08-07 15:42:00
[Information] Loading objects:
[Information] port1
[Information] [1] "Loading variable port1..."
[Information] package 'lexicon' successfully unpacked and MD5 sums checked
[Information] package 'textclean' successfully unpacked and MD5 sums checked
[Information] package 'textshape' successfully unpacked and MD5 sums checked
[Information] package 'syuzhet' successfully unpacked and MD5 sums checked
[Information] package 'sentimentr' successfully unpacked and MD5 sums checked
有人见过这个或类似的问题吗?难不成"successfully unpacked"不等于安装成功可以使用了?
感谢来自@bryan_hepworth的a hint on Twitter,我现在可以回答我自己的问题了。
R 包安装正确,但不在标准库位置。因此,当来自 sentimentr
的函数运行时,R 会尝试加载依赖包 textshape
:
library(textshape)
在标准位置中当然不存在,因为 Azure ML 不支持它。
解决方案是从其安装位置显式加载 textshape
:
library(textshape, lib.loc = ".")
因此解决方案是:显式加载您在 R 代码开头安装的包,而不是让 R 尝试将它们作为依赖项加载,否则会失败。
我正在尝试在 Azure ML Studio 上使用 R sentimentr
包。由于不支持此软件包,我正在尝试按照 in the documentation.
我执行的步骤是:
- 的 R Open 3.4.4 快照下载 Windows 个二进制文件
sentimentr_2.2.3.zip
syuzhet_1.0.4.zip
textclean_0.6.3.zip
lexicon_0.7.4.zip
textshape_1.5.0.zip
将这些 zip 文件压缩到压缩文件夹中
packages.zip
- 已将
packages.zip
作为数据集上传到 Microsoft Azure ML Studio
在我的 ML 实验中,我将 packages.zip
数据集连接到 "Execute R Script" 上的 "Script Bundle (Zip)" 输入端口并包含此代码:
# install R package contained in src
install.packages("src/lexicon_0.7.4.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/textclean_0.6.3.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/textshape_1.5.0.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/syuzhet_1.0.4.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
install.packages("src/sentimentr_2.2.3.zip",
lib = ".",
repos = NULL,
verbose = TRUE)
# load libraries
library(sentimentr, lib.loc = ".", verbose = TRUE)
实验运行成功,直到我包含来自 sentimentr
:
mydata <- mydata %>%
get_sentences() %>%
sentiment()
这给出了错误:
there is no package called 'textshape'
这很难理解,因为输出日志并未表明包存在问题:
[Information] The following files have been unzipped for sourcing in path=["src"]:
[Information] Name Length Date
[Information] 1 sentimentr_2.2.3.zip 3366245 2019-08-07 14:57:00
[Information] 2 syuzhet_1.0.4.zip 2918474 2019-08-07 15:05:00
[Information] 3 textclean_0.6.3.zip 1154814 2019-08-07 15:13:00
[Information] 4 lexicon_0.7.4.zip 4551995 2019-08-07 15:17:00
[Information] 5 textshape_1.5.0.zip 463095 2019-08-07 15:42:00
[Information] Loading objects:
[Information] port1
[Information] [1] "Loading variable port1..."
[Information] package 'lexicon' successfully unpacked and MD5 sums checked
[Information] package 'textclean' successfully unpacked and MD5 sums checked
[Information] package 'textshape' successfully unpacked and MD5 sums checked
[Information] package 'syuzhet' successfully unpacked and MD5 sums checked
[Information] package 'sentimentr' successfully unpacked and MD5 sums checked
有人见过这个或类似的问题吗?难不成"successfully unpacked"不等于安装成功可以使用了?
感谢来自@bryan_hepworth的a hint on Twitter,我现在可以回答我自己的问题了。
R 包安装正确,但不在标准库位置。因此,当来自 sentimentr
的函数运行时,R 会尝试加载依赖包 textshape
:
library(textshape)
在标准位置中当然不存在,因为 Azure ML 不支持它。
解决方案是从其安装位置显式加载 textshape
:
library(textshape, lib.loc = ".")
因此解决方案是:显式加载您在 R 代码开头安装的包,而不是让 R 尝试将它们作为依赖项加载,否则会失败。