首页 > 解决方案 > 安装 tdplyr 包失败。错误:参数不是环境

问题描述

感谢您查看我的第一篇文章。请忍受我的格式。

问题摘要:在我测试另一个需要潜在性能增强的包之前,我一直在使用tdplyr没有问题的访问 teradata 数据库。dplyr.teradata但是,由于以下错误消息,我无法再连接到数据库:

错误:“tdplyr”的包或命名空间加载失败:.onLoad 在“tdplyr”的 loadNamespace() 中失败,详细信息:调用:parent.env(from) 错误:参数不是环境

所以我删除了 dplyr.teradata 包,以为这样可以让我原来的 tdplyr 工作,但我仍然收到上面相同的错误消息。然后我删除了没有备份的 tdplyr 包,尝试使用下面的原始脚本重新安装:

install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r- 
project.org'))

但由于同样的错误再次安装失败。希望有人可以建议修复。

我的会话信息如下:

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] rlang_0.4.10         teradatasql_17.0.0.8 odbc_1.3.0           dplyr_1.0.2         
 [5] dbplyr_2.0.0         digest_0.6.27        DBI_1.1.0            hms_0.5.3           
 [9] bit64_4.0.5          bit_4.0.4           

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5       rstudioapi_0.13  magrittr_1.5     tidyselect_1.1.0 R6_2.4.1        
 [6] blob_1.2.1       tools_4.0.3      xfun_0.20        tinytex_0.28     ellipsis_0.3.1  
[11] assertthat_0.2.1 tibble_3.0.4     lifecycle_0.2.0  crayon_1.3.4     zip_2.1.1       
[16] purrr_0.3.4      vctrs_0.3.6      glue_1.4.2       openxlsx_4.2.3   stringi_1.5.3   
[21] compiler_4.0.3   pillar_1.4.6     generics_0.0.2   pkgconfig_2.0.3 

标签: rteradata

解决方案


自己找到了答案。粘贴下面的答案。

Teradata R 软件包与 dbplyr v2.0.0 及其更高版本不兼容,后者引入了一些重大更改。要使用 tdplyr,dbplyr 包的版本必须是 v1.4.4。tdplyr 应使用终端(适用于 Linux 和 Mac)或命令提示符(适用于 Windows)中的以下命令安装,直到发布与 dbplyr v2.0.0 及其更高版本兼容的新版本:

首先安装 dbplyr v1.4.4。有多种方法可以安装特定版本的 R 包。Teradata 建议使用以下命令: Rscript -e "remotes::install_version('dbplyr',version='1.4.4',repos='https://cloud.r-project.org')" 注意:要运行此命令上面的命令,R 包遥控器应该存在于客户端计算机上。

接下来要自动下载和安装 tdplyr 和依赖项,如果不满足最低要求的版本,请在 install.packages 的 repos 参数中指定 Teradata R 包存储库和 CRAN。Rscript -e "install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-project.org'))"


推荐阅读