0

I installed shiny using system wide installation method. So it is now at /usr/local/lib/R/site-library . And I'm using R Studio to install other packages such as RMySQL, ShinyBS etc. Those packages are located in /home/thisa/R/x86_64-pc-linux-gnu-library/3.0 . Now when I run my server.R with following libraries,

library("shinyBS", lib.loc="/home/thisa/R/x86_64-pc-linux-gnu-library/3.0")

It pops up following error.

ERROR: no library trees found in 'lib.loc'

What would be the possible solution for this should I change my default install directory of R Studio then how can I do that? I found similar problem here but the answer is not clear for me.

Community
  • 1
  • 1
Thisara Watawana
  • 344
  • 4
  • 15

2 Answers2

1

I truly dislike local installations below $HOME for that very reason.

Do this:

  1. In R, do .libPaths() which will show the set of library directories known to R. Packages will go into the first of these.

  2. On my system, I only get "/usr/local/lib/R/site-library", "/usr/lib/R/site-library" and "/usr/lib/R/library"

  3. I am explicitly setting (in /etc/R/Renviron) R_LIBS_SITE to be ${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'} which excludes the user library.

  4. I may have had to override a default in RStudio as well but I don't see right now where that has been. You can of course check by looking at .libPaths() as per 1. above.

In short, if you get the result I show in 2. then your libraries will all end up in /usr/local/lib/R/site-library and be visible to all instances, including Shiny apps.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
0

For me I followed the steps listed above by @Dirk and I had to perform one extra step. Adding the user to the staff group.

In the terminal run.

sudo usermod -a -G staff user_name

Replace user_name with your user name. After restart and login in again. You should be able to install packages system-wide.