install.packages() Rstudio server AWS ubuntu error

2019-08-02 18:31发布

I have an AWS instance running ubuntu 12.04 and shiny server as well as Rstudio, however, when I try to add packages, I get an error when trying to load the library()

for the following command: install.packages("jsonlite", dependencies = TRUE, repos="http://cran.cs.wwu.edu") terminal output shows the download happens without any issues with the following as the last line The downloaded source packages are in ‘/tmp/RtmpO02nLU/downloaded_packages’

Clearly library() shows an error eg// Error in library(jsonlite) : there is no package called ‘jsonlite’ Is there something wrong with this process? how can I install packages to work with my Instance/ environment?

EDIT:: I realise there is the option of creating a swap file, wondering with the t1 instance, is there something really inefficient with the set up? rather than doing this or just upgrading the instance with throwing more memory at it..

2条回答
何必那么认真
2楼-- · 2019-08-02 18:49

You may want to sudo R to run R. Otherwise it won't allow you to install R package into the R library directory. Once you sudo R, then use install.packages again. Hope it works for you. I had similar problem before.

查看更多
家丑人穷心不美
3楼-- · 2019-08-02 18:53

I had the same issue using a Virtual Machine through vagrant.

After updating the R version, I got the useful warning that the installation of the R package shiny failed because of lack of memory. I was using 512 Mb for RAM, this is not enough. After tweaking the Vagrantfile:

config.vm.provider "virtualbox" do |vb|
  # Customize the amount of memory on the VM:
  b.memory = "2048"
end

It worked out. Of note, to install dplyr I had to increase the virtual memory to 2048 Mb.

Hope this helps

查看更多
登录 后发表回答