Shiny not loading specific packages on Centos 7

Hi. I cant get Shiny to run with specific packages on Centos 7, although it runs locally.

The app runs an extremely simple/basic app which is visually confirmed with library(shiny) and library(bslib) however when I start to introduce other packages, such as with library(dplyr) it kicks the error ‘An error has occurred. Check your logs or contact the app author for clarification.’ . It is not just dplyr, I am focusing on this one only for this query.

The log prints this…
su: ignore --preserve-environment, it's mutually exclusive to --login.
Listening on
Warning: Error in library: no library trees found in 'lib.loc'
72: stop
71: library
Execution halted

I followed some online advise and placed the following as the top of ui.R, with the expectation that it would use a bit of brute force to install dplyr.


it generated this log output…

su: ignore --preserve-environment, it's mutually exclusive to --login.
Listening on
Loading required package: dplyr
Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘dplyr’
Warning in install.packages("dplyr") :
'lib = "/opt/R/3.6.2/lib/R/library"' is not writable
Warning: Error in install.packages: unable to install packages
72: stop
71: install.packages

It looks like it is trying to place dplyr in an old library for 3.6.2. I tried again specifying lib = "/home/kamanyi/R/x86_64-pc-linux-gnu-library/4.0" in the install.packages but it reverts that is not writable. I set it to chmod 777 but it still states the same ‘not writable’.

Even though it says there is no package, I can see it with installed.packages(). V 1.0.5 is listed in ‘/home/kamanyi/R/x86_64-pc-linux-gnu-library/4.0’.

The issue has occurred with shiny 1.6.0, but I have now installed the github version ( and it does the same. I unistalled shinyserver and reinstalled (confirmed as

R version 4.0.4 (2021-02-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/


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

loaded via a namespace (and not attached):
[1] compiler_4.0.4

Any suggestions on my next approach please? And what other info should I provide to shed light?

I took this task on yesterday and updated the existing 3.6.2 version of R. It took a couple of attempts and /opt/R/ has folders for 3.6.2, 4.0.0, 4.0.4 and devel. I wouldn’t have thought that’s applicable but I mention for clarity.

It seems to me that you have not set permissions properly for the run_as user and probably your library path is not set correctly either.
Also be aware that shiny is not "normally" capable of accessing packages in your user level library, most commonly you install packages for shiny on the system level package library and as a super user.

the run_as user is the default configuration (I think). Here is the config file for reference.

Instruct Shiny Server to run applications as the user "shiny"

run_as shiny;

Define a server that listens on port 3838

preserve_logs true;

server {
listen 3838;

Define a location at the base URL

location / {

# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;

# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;

# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;


Regarding the library path... the return on .libPaths() is as below. Should I be updating them to some other folder? Thanks for the pointers so far. Really helpful and much appreciated.

NB. the first libpath was created by R during installation; it spit put some text that the second libpath was not writable so I said 'yes' to its prompt for number [1].

[1] "/home/kamanyi/R/x86_64-pc-linux-gnu-library/4.0"
[2] "/opt/R/4.0.4/lib/R/library"

Ahhh - Ok. I got it thanks. I might have been looking too deep. I edited the run_user and it all fell into place. Thanks for you help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.