簡體   English   中英

R(Ubuntu) - 無法安裝軟件包“readr”和“eurostat”

[英]R (Ubuntu) - Can't install packages “readr” and “eurostat”

我在R中安裝“eurostats”軟件包時出現問題。在解決問題之后,我推斷問題在於“readr”軟件包。 嘗試安裝它,會發生這種情況:

* installing *source* package ‘readr’ ...
** libs
g++ -I/usr/share/R/include -DNDEBUG   -I"/home/shiny/R/x86_64-pc-linux-gnu-library/3.3/Rcpp/include" -I"/home/shiny/R/x86_64-pc-linux-gnu-library/3.3/BH/include"   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c Collector.cpp -o Collector.o

之后終端只是凍結,好像它是活躍的但沒有任何反應。在此之前,我有點處理區域設置(如果它有幫助就提到它)。 我能夠安裝其他軟件包。

我的R和Linux詳細信息如下:

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] httr_1.2.1      R6_2.2.0        tools_3.3.2     withr_1.0.2    
[5] curl_2.2        memoise_1.0.0   git2r_0.16.0    digest_0.6.10  
[9] devtools_1.12.0

有人可以幫幫我嗎?

您的計算機上沒有足夠的RAM。 所以你有兩個選擇:

  • 繼續你正在做的事情,並嘗試從源代碼編譯,這將需要更多的內存,並可能會失敗

  • 安裝一個預先構建的二進制文件(!!),這樣你就不必在第一時間編譯

最簡單的方法是這樣的(我在Ubuntu 16.04的Docker實例中只顯示命令而不顯示輸出,我在Docker中執行此操作,其中帳戶是root ;否則在前面添加sudo

apt-get update     # refresh
apt-get install software-properties-common
add-apt-repository -y "ppa:marutter/rrutter"
add-apt-repository -y "ppa:marutter/c2d4u"
apt-get update     # now with new repos
apt-get install r-cran-readr

瞧,你有readr包。 現在繼續使用未打包為二進制文件的eurostat,但由於其C ++代碼,可能不需要更大的資源。

我的覆盆子pi也有同樣的問題。 解決方法是增加交換的大小(在我的情況下增加到1Gb)。 以下是步驟:

sudo swapon -s #get size and filename
sudo swapoff -a #stop the actual swaps
sudo fallocate -l 1g swap2 #allocate 1Gb for the swapfile
sudo mkswap swap2
sudo swapon swap2

啟動R並安裝軟件包。

如果您需要返回以前的配置:

sudo swapoff -a
sudo rm swap2
sudo swapon your-previous-swap

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM