首页 > 解决方案 > (R) Error when trying to load the SQLDF package

问题描述

I have been having some trouble running the following code:

install.packages("sqldf",dep=TRUE)
library(sqldf)
install.packages("RSQLite",dep=TRUE)
library(RSQLite)

After running this, my intention is to use the sqldf function to run some queries, but I've gotten stuck on an error I'm not sure how to solve and I've had trouble finding any other answers on Stack Overflow that could be helpful.

The following is the error I receive after running the first line:

 Loading required package: RSQLite
 Error: package or namespace load failed for ‘RSQLite’ in loadNamespace(i, c(lib.loc, .libPaths()),     versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.4.0 is already loaded, but >= 0.4.2 is required
 Error: package ‘RSQLite’ could not be loaded

I then tried running:

install.packages("rlang")

but received the following error:

package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot remove prior installation of package ‘rlang’
Warning in install.packages :
  problem copying C:\Users\My Name\Documents\R\win-library\3.6\00LOCK\rlang\libs\x64\rlang.dll to     C:\Users\My Name\Documents\R\win-library\3.6\rlang\libs\x64\rlang.dll: Permission denied
Warning in install.packages :
  restored ‘rlang’

I am befuddled. Not sure how to begin addressing this issue. Any help or insight would be appreciated! Thank you!

标签: rdependenciessqldfrlangrsqlite

解决方案


更新已安装的包需要 R 能够更新unload该包。通常这可以很容易地完成,但通常可能会出现问题,特别是对于已编译库的包(.so.lib.dll,取决于 SO)。我不知道能够解开这些共享对象所需的步骤,但它通常不起作用。这会使更新过程处于不良状态: (1) 未更新但仍可用于此会话和当前会话;或 (2) 未更新且磁盘存储处于无法使用的部分状态(可能是其他状态)。

即使可以使用共享对象更新包,唯一有保证的方法(特别是如果您遇到问题)是将 R 重新启动到没有加载该包的状态。如果您正在自动加载包(由于.Rprofileor .Rdata),那么您需要确保在没有这些措施的情况下开始(可能是“新项目”和/或.Rprofile暂时移开)。

所以...重新启动 R 并重新尝试安装/更新所有失败的包。


推荐阅读