Linux中conda安装R出现 package ‘utils’ in options("defaultPackages")

分享
开发者 2024-9-20 12:19:47 88 0 来自 中国
题目

Linux情况下,使用conda乐成安装了R4。但提示‘utils’和‘stats’包未找到,如下:
R version 4.1.3 (2022-03-10) -- "One Push-Up"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-conda-linux-gnu (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.  Natural language support but running in an English localeR is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.During startup - Warning messages:1: package ‘utils’ in options("defaultPackages") was not found2: package ‘stats’ in options("defaultPackages") was not found此时安装R包或运行其他下令都直接报错,如:
> install.packages("ggplot2")Error in install.packages("ggplot2") :  could not find function "install.packages"办理一

没去分析缘故原由,在网上查了下。找到安装R情况下的库文件ldpaths,末了一行加上export EDITOR=vim,似乎可以。如下:
echo "export EDITOR=vim" >> /opt/conda/envs/r4py3/lib/R/etc/ldpaths正常。
R version 4.1.3 (2022-03-10) -- "One Push-Up"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-conda-linux-gnu (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.  Natural language support but running in an English localeR is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.
https://www.jianshu.com/p/e0c337c50211
但是,当我第二次用docker打包时,却又出现了这个玩意。分析以上方法不是根本的办理之道。
办理二

网上又查了一圈,说是conda新建的情况中没有which,安装which即可。
(r4py3) [root@a3ef4a44aa1f etc]# whichbash: which: command not found(r4py3) [root@a3ef4a44aa1f etc]# yum install -y which
https://github.com/ContinuumIO/anaconda-issues/issues/11133
https://www.cnblogs.com/flowerbirds/p/14191783.html
确实,安装后齐备又正常了。
(r4py3) [root@a3ef4a44aa1f etc]# RR version 4.1.3 (2022-03-10) -- "One Push-Up"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-conda-linux-gnu (64-bit)R is free software and comes with ABSOLUTELY NO WARRANTY.You are welcome to redistribute it under certain conditions.Type 'license()' or 'licence()' for distribution details.  Natural language support but running in an English localeR is a collaborative project with many contributors.Type 'contributors()' for more information and'citation()' on how to cite R or R packages in publications.Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an HTML browser interface to help.Type 'q()' to quit R.然而,网上仍有一些复兴说他们安装which也没用。
R depends on which, which might not be present in the conda R environment. Maybe it could be as simple as to add the which-derivation to conda?Placing ‘which’ into the conda binary folder did however not fix the issue (the R console still complains about not being able to load stats and utils packages)
https://discourse.nixos.org/t/r-installation-within-conda-cannot-find-default-libraries/8437
一些人发起设置set R_HOME path,也有发起重新安装其他版本的R。
我用which乐成办理,后续没什么题目了,就没尝试了。还有不乐成的小搭档可以多试试多查查,大不了重新安装。
您需要登录后才可以回帖 登录 | 立即注册

Powered by CangBaoKu v1.0 小黑屋藏宝库It社区( 冀ICP备14008649号 )

GMT+8, 2024-10-19 02:16, Processed in 0.160838 second(s), 32 queries.© 2003-2025 cbk Team.

快速回复 返回顶部 返回列表