Linux中conda安裝R出現(xiàn) package ‘utils’ in options("defaultPackages") was not found型酥?

問題

Linux環(huán)境下山憨,使用conda成功安裝了R4查乒。但提示‘utils’和‘stats’包未找到,如下:

R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: 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 locale

R 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 found
2: package ‘stats’ in options("defaultPackages") was not found

此時(shí)安裝R包或運(yùn)行其他命令都直接報(bào)錯(cuò)郁竟,如:

> install.packages("ggplot2")
Error in install.packages("ggplot2") :
  could not find function "install.packages"

解決一

沒去分析原因玛迄,在網(wǎng)上查了下。找到安裝R環(huán)境下的庫文件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 Computing
Platform: 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 locale

R 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.

http://www.reibang.com/p/e0c337c50211

但是,當(dāng)我第二次用docker打包時(shí)嘹屯,卻又出現(xiàn)了這個(gè)玩意。說明以上方法不是根本的解決之道。

解決二

網(wǎng)上又查了一圈殿雪,說是conda新建的環(huán)境中沒有which嘿悬,安裝which即可。

(r4py3) [root@a3ef4a44aa1f etc]# which
bash: 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

確實(shí)婆翔,安裝后一切又正常了拯杠。

(r4py3) [root@a3ef4a44aa1f etc]# R

R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: 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 locale

R 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.

然而,網(wǎng)上仍有一些回答說他們安裝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

一些人建議設(shè)置set R_HOME path潭陪,也有建議重新安裝其他版本的R。

我用which成功解決最蕾,后續(xù)沒什么問題了依溯,就沒嘗試了。還有不成功的小伙伴可以多試試多查查瘟则,大不了重新安裝黎炉。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市醋拧,隨后出現(xiàn)的幾起案子慷嗜,更是在濱河造成了極大的恐慌,老刑警劉巖丹壕,帶你破解...
    沈念sama閱讀 221,635評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件庆械,死亡現(xiàn)場離奇詭異,居然都是意外死亡菌赖,警方通過查閱死者的電腦和手機(jī)干奢,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,543評論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來盏袄,“玉大人忿峻,你說我怎么就攤上這事薄啥。” “怎么了逛尚?”我有些...
    開封第一講書人閱讀 168,083評論 0 360
  • 文/不壞的土叔 我叫張陵垄惧,是天一觀的道長。 經(jīng)常有香客問我绰寞,道長到逊,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,640評論 1 296
  • 正文 為了忘掉前任滤钱,我火速辦了婚禮觉壶,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘件缸。我一直安慰自己铜靶,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,640評論 6 397
  • 文/花漫 我一把揭開白布他炊。 她就那樣靜靜地躺著争剿,像睡著了一般。 火紅的嫁衣襯著肌膚如雪痊末。 梳的紋絲不亂的頭發(fā)上蚕苇,一...
    開封第一講書人閱讀 52,262評論 1 308
  • 那天,我揣著相機(jī)與錄音凿叠,去河邊找鬼涩笤。 笑死,一個(gè)胖子當(dāng)著我的面吹牛盒件,可吹牛的內(nèi)容都是我干的辆它。 我是一名探鬼主播,決...
    沈念sama閱讀 40,833評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼履恩,長吁一口氣:“原來是場噩夢啊……” “哼锰茉!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起切心,我...
    開封第一講書人閱讀 39,736評論 0 276
  • 序言:老撾萬榮一對情侶失蹤飒筑,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后绽昏,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體协屡,經(jīng)...
    沈念sama閱讀 46,280評論 1 319
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,369評論 3 340
  • 正文 我和宋清朗相戀三年全谤,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了肤晓。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,503評論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖补憾,靈堂內(nèi)的尸體忽然破棺而出漫萄,到底是詐尸還是另有隱情,我是刑警寧澤盈匾,帶...
    沈念sama閱讀 36,185評論 5 350
  • 正文 年R本政府宣布腾务,位于F島的核電站,受9級特大地震影響削饵,放射性物質(zhì)發(fā)生泄漏岩瘦。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,870評論 3 333
  • 文/蒙蒙 一窿撬、第九天 我趴在偏房一處隱蔽的房頂上張望启昧。 院中可真熱鬧,春花似錦劈伴、人聲如沸密末。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,340評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽苏遥。三九已至饼拍,卻和暖如春赡模,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背师抄。 一陣腳步聲響...
    開封第一講書人閱讀 33,460評論 1 272
  • 我被黑心中介騙來泰國打工漓柑, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人叨吮。 一個(gè)月前我還...
    沈念sama閱讀 48,909評論 3 376
  • 正文 我出身青樓辆布,卻偏偏與公主長得像,于是被迫代替她去往敵國和親茶鉴。 傳聞我的和親對象是個(gè)殘疾皇子锋玲,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,512評論 2 359

推薦閱讀更多精彩內(nèi)容