简体   繁体   English

loadNamespace(name) 错误:没有名为“Rcpp”的包

[英]Error in loadNamespace(name) : there is no package called 'Rcpp'

I am trying to embed RInside to my application on win7 64-bit system but when I initialize an RInside:我正在尝试将 RInside 嵌入到我在 win7 64 位系统上的应用程序中,但是当我初始化 RInside 时:

Rin = new RInside(argc, argv);

the following message appears:出现以下消息:

Error in loadNamespace(name) : there is no package called 'Rcpp' loadNamespace(name) 错误:没有名为“Rcpp”的包

This error only occurs with Windows.此错误仅在 Windows 中发生。

I think you get that issue when your .libPaths() differ--in other words run the .libPaths() function to see the paths stored by R for its use.我认为当你的.libPaths()不同时你会遇到这个问题——换句话说,运行.libPaths()函数来查看 R 存储的路径供其使用。 Then check where RInside is installed, and make sure Rcpp is installed there too.然后检查RInside的安装位置,并确保Rcpp也安装在那里。 It is a setup issue.这是一个设置问题。

In other words, it should work if you have Rcpp and RInside installed where the basic R libraries are.换句话说,如果您在基本 R 库所在的RInside安装了RcppRInside ,它应该可以工作。 Otherwise you have to tell the (embedded) R session about the other location (and before it starts).否则,您必须告诉(嵌入式)R 会话有关其他位置的信息(并且在它开始之前)。

There are more Windows users on the list, so you could try asking on rcpp-devel.列表中有更多的 Windows 用户,因此您可以尝试在 rcpp-devel 上询问。

  1. First get your default library locations by command ".Library" in R.首先通过 R 中的命令“.Library”获取默认库位置。
  2. Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html .https://cran.r-project.org/web/packages/Rcpp/index.html获取 Rcpp 包。
  3. Unzip and copy folder "Rcpp" to your default library locations obtained from step1.将文件夹“Rcpp”解压缩并复制到从步骤 1 获得的默认库位置。

Now you are ready to install packages which have dependencies on Rcpp.现在您已准备好安装依赖于 Rcpp 的软件包。

Dirk is right in this case, BUT if the .libPaths() does not work, then please also check if you have the latest packages.在这种情况下,Dirk 是对的,但是如果 .libPaths() 不起作用,那么还请检查您是否有最新的软件包。

I am posting this as an ancillary answer backup which I ran into with the shiny package backend switch of their code needing Rcpp !我将此作为辅助答案备份发布,我遇到了需要Rcpp的代码的shiny包后端开关!

In this case of getting the "no package" error message, I fixed it by:在收到“无包”错误消息的情况下,我通过以下方式修复了它:

  1. Selecting devtools package and then using this line below.选择devtools包,然后使用下面的这一行。 (if you don't have devtools then get it with install.packages("devtools") (如果您没有 devtools,则使用install.packages("devtools")获取它

  2. devtools::install_github("rstudio/shiny")

The development version of the package handled this better, and added the package as a dependency.包的开发版本处理得更好,并将包添加为依赖项。

Mods - I realize this is an answer to an old question, but I might help others not wasting an hour like I just did. Mods - 我意识到这是一个老问题的答案,但我可能会帮助其他人不要像刚才那样浪费一个小时。

You might find it easy if the answers are for both R studio users and non R studio users.如果答案适用于 R 工作室用户和非 R 工作室用户,您可能会发现这很容易。

R Studio users R Studio 用户

  1. First get your default library locations by command ".Library" in R.首先通过 R 中的命令“.Library”获取默认库位置。
  2. Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html .https://cran.r-project.org/web/packages/Rcpp/index.html获取 Rcpp 包。
  3. Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.将文件夹“Rcpp”解压并复制到步骤1中获得的默认库位置,您将找到另一个名为library的文件夹,将解压文件夹粘贴在其中。

Non R studio Users非 R 工作室用户

  1. First get your default library locations by command ".libPath" in R.首先通过 R 中的命令“.libPath”获取默认库位置。
  2. Get Rcpp package from https://cran.r-project.org/web/packages/Rcpp/index.html .https://cran.r-project.org/web/packages/Rcpp/index.html获取 Rcpp 包。
  3. Unzip and copy folder "Rcpp" to your default library locations obtained from step 1, you will find another folder named library, paste the unzip folder in it.将文件夹“Rcpp”解压并复制到步骤1中获得的默认库位置,您将找到另一个名为library的文件夹,将解压文件夹粘贴在其中。

I was also getting this error while trying to run the 'ggplot' function from the ggplot2 package.我在尝试从 ggplot2 包中运行“ggplot”函数时也遇到了这个错误。 After trying the suggestions posted here and elsewhere (checking file paths, restarting R, clearing out my environment, etc.) and encountering several other cryptic error messages, it turned out that I needed to download the latest version of base R for Windows (v3.4.1) and update my version of R-Studio to the latest version also (v1.0.153).在尝试了这里和其他地方发布的建议(检查文件路径、重新启动 R、清除我的环境等)并遇到其他几个神秘的错误消息后,结果证明我需要下载最新版本的 Windows 基础 R (v3 .4.1)并将我的 R-Studio 版本也更新到最新版本 (v1.0.153)。

After doing this my 'ggplot' function was working again and I was able to render my figure from R Studio without any further issues.完成此操作后,我的 'ggplot' 功能再次运行,我能够从 R Studio 渲染我的图形,而没有任何进一步的问题。

I was also getting this message when trying to use ggplot.尝试使用 ggplot 时,我也收到此消息。 I first updating both my R for Windows to 3.4.3.我首先将我的 R for Windows 更新到 3.4.3。 Then updating R studio to version 1.1.423;然后将 R studio 更新到 1.1.423 版本; then, updating all of the packages and being sure to access the R version 3.4.3 from R studio, I still got the message.然后,更新所有包并确保从 R studio 访问 R 版本 3.4.3,我仍然收到消息。 None of these things fixed the error.这些东西都没有修复错误。 I was ready to give up until I noticed that I was calling library(ggplot) and had ggplot::ggplot in my code.我准备放弃,直到我注意到我正在调用 library(ggplot) 并且在我的代码中有 ggplot::ggplot。 THIS WAS THE PROBLEM.这就是问题所在。 I changed it to library(ggplot2) and the instance to ggplot2::ggplot(...).我将其更改为 library(ggplot2) 并将实例更改为 ggplot2::ggplot(...)。 THIS FIXEd the problems.这解决了问题。

I was facing a similar issue, and I simply installed the said package.我遇到了类似的问题,我只是安装了上述软件包。 It's working perfectly for me.它对我来说完美无缺。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 loadNamespace(name)中的错误:没有名为“ Rcompression”的软件包 - Error in loadNamespace(name) : there is no package called ‘Rcompression’ loadNamespace(name)中的错误:没有名为“ RInside”的软件包 - Error in loadNamespace(name) : there is no package called 'RInside' loadNamespace(name) 中的错误:没有名为“evaluate”的包 - Error in loadNamespace(name) : there is no package called 'evaluate' 在R中运行Quandl“loadNamespace(name)中的错误:没有名为'curl'的包 - Running Quandl in R “Error in loadNamespace(name) : there is no package called ‘curl’” knitr :: knit2pdf [loadNamespace(name)中的错误:没有名为“ tinytex”调用的程序包] - knitr::knit2pdf [Error in loadNamespace(name) : there is no package called 'tinytex' Calls] Rstudio中的Rstudio knit pdf loadNamespace(name):没有名为'rmarkdown'的包 - Rstudio knit pdf in Rstudio loadNamespace(name): there is no package called 'rmarkdown' 对于Copula包,R中的loadNamespace出错 - Error in loadNamespace in R for Copula package Rcpp报告错误:DLL不在软件包“ Rcpp”的C符号名称“ sourceCppContext”中 - Rcpp reports an error: C symbol name “sourceCppContext” not in DLL for package “Rcpp” 错误:loadNamespace 中“tidyverse”的包或命名空间加载失败 - Error: package or namespace load failed for ‘tidyverse’ in loadNamespace loadNamespace中的错误,软件包plm找不到对象'vI' - Error in loadNamespace, object 'vI' not found with package plm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM