Change default loading of `shiny` to specific `.libPaths()` on ShinyServer










0















Problem



I'm deploying a Shiny App on a shiny server maintained by my university, and there are many .libPaths() that contain different versions of packages.



> .libPaths()
[1] "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4"
[2] "/nfs/admin/software/xenial/system-gcc/R_libs"
[3] "/usr/local/lib/R/site-library"
[4] "/usr/lib/R/site-library"
[5] "/usr/lib/R/library"


When my shiny app boots up, shiny is loaded by default from .libPaths()[2], which then imports R6 V.2.2.1, also from this path.



However, my code depends on R6 >= V.2.2.2, which I have in .libPaths()[1].



It would be simple enough to have my SysAdmin update R6 in .libPaths()[2], but they cannot because other people's apps depend on the libraries on that path, and we don't want to break those.




I've tried:




  1. detaching R6 and loading it from .libPaths()[1]



    detach("package:R6", unload=TRUE, force = TRUE, character.only = TRUE)
    library(R6, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  2. detaching shiny and loading it from .libPaths()[1]



    detach("package:shiny", unload=TRUE, force = TRUE, character.only = TRUE)
    library(shiny, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  3. setting my .libPaths() from the start in the global.R file to only include the path I want.



    .libPaths(.libPaths()[1])



  4. adding an etc folder under "/zeolite/rpauloo/R" that contains the following Rprofile.site file (advice from here):



    .First <- function()
    .libPaths("/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



None of these approaches work. Why?




  1. R6 is an attached package, so it can't be unloaded.

  2. not sure why unloading/reloading shiny doesn't work

  3. Shiny Server loads shiny from .libPaths()[2] to begin with, before the global.R file is sourced, so setting libPaths() doesn't help.

  4. the Rprofile.site file is probably in the wrong directory, but putting it in an admin directory will mess with other apps


Question



How can I configure my shiny app to load shiny from a specific .libPath on startup?



Or have I mis-conceptualized the problem? Is there another way to go about this?










share|improve this question



















  • 1





    Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

    – zacdav
    Nov 14 '18 at 0:53












  • @zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

    – Rich Pauloo
    Nov 14 '18 at 1:16






  • 1





    The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

    – zacdav
    Nov 14 '18 at 2:20












  • @zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

    – Rich Pauloo
    Nov 14 '18 at 17:30











  • Does the user that the shiny server is running as have read/write access to those paths?

    – zacdav
    Nov 14 '18 at 23:08















0















Problem



I'm deploying a Shiny App on a shiny server maintained by my university, and there are many .libPaths() that contain different versions of packages.



> .libPaths()
[1] "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4"
[2] "/nfs/admin/software/xenial/system-gcc/R_libs"
[3] "/usr/local/lib/R/site-library"
[4] "/usr/lib/R/site-library"
[5] "/usr/lib/R/library"


When my shiny app boots up, shiny is loaded by default from .libPaths()[2], which then imports R6 V.2.2.1, also from this path.



However, my code depends on R6 >= V.2.2.2, which I have in .libPaths()[1].



It would be simple enough to have my SysAdmin update R6 in .libPaths()[2], but they cannot because other people's apps depend on the libraries on that path, and we don't want to break those.




I've tried:




  1. detaching R6 and loading it from .libPaths()[1]



    detach("package:R6", unload=TRUE, force = TRUE, character.only = TRUE)
    library(R6, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  2. detaching shiny and loading it from .libPaths()[1]



    detach("package:shiny", unload=TRUE, force = TRUE, character.only = TRUE)
    library(shiny, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  3. setting my .libPaths() from the start in the global.R file to only include the path I want.



    .libPaths(.libPaths()[1])



  4. adding an etc folder under "/zeolite/rpauloo/R" that contains the following Rprofile.site file (advice from here):



    .First <- function()
    .libPaths("/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



None of these approaches work. Why?




  1. R6 is an attached package, so it can't be unloaded.

  2. not sure why unloading/reloading shiny doesn't work

  3. Shiny Server loads shiny from .libPaths()[2] to begin with, before the global.R file is sourced, so setting libPaths() doesn't help.

  4. the Rprofile.site file is probably in the wrong directory, but putting it in an admin directory will mess with other apps


Question



How can I configure my shiny app to load shiny from a specific .libPath on startup?



Or have I mis-conceptualized the problem? Is there another way to go about this?










share|improve this question



















  • 1





    Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

    – zacdav
    Nov 14 '18 at 0:53












  • @zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

    – Rich Pauloo
    Nov 14 '18 at 1:16






  • 1





    The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

    – zacdav
    Nov 14 '18 at 2:20












  • @zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

    – Rich Pauloo
    Nov 14 '18 at 17:30











  • Does the user that the shiny server is running as have read/write access to those paths?

    – zacdav
    Nov 14 '18 at 23:08













0












0








0








Problem



I'm deploying a Shiny App on a shiny server maintained by my university, and there are many .libPaths() that contain different versions of packages.



> .libPaths()
[1] "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4"
[2] "/nfs/admin/software/xenial/system-gcc/R_libs"
[3] "/usr/local/lib/R/site-library"
[4] "/usr/lib/R/site-library"
[5] "/usr/lib/R/library"


When my shiny app boots up, shiny is loaded by default from .libPaths()[2], which then imports R6 V.2.2.1, also from this path.



However, my code depends on R6 >= V.2.2.2, which I have in .libPaths()[1].



It would be simple enough to have my SysAdmin update R6 in .libPaths()[2], but they cannot because other people's apps depend on the libraries on that path, and we don't want to break those.




I've tried:




  1. detaching R6 and loading it from .libPaths()[1]



    detach("package:R6", unload=TRUE, force = TRUE, character.only = TRUE)
    library(R6, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  2. detaching shiny and loading it from .libPaths()[1]



    detach("package:shiny", unload=TRUE, force = TRUE, character.only = TRUE)
    library(shiny, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  3. setting my .libPaths() from the start in the global.R file to only include the path I want.



    .libPaths(.libPaths()[1])



  4. adding an etc folder under "/zeolite/rpauloo/R" that contains the following Rprofile.site file (advice from here):



    .First <- function()
    .libPaths("/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



None of these approaches work. Why?




  1. R6 is an attached package, so it can't be unloaded.

  2. not sure why unloading/reloading shiny doesn't work

  3. Shiny Server loads shiny from .libPaths()[2] to begin with, before the global.R file is sourced, so setting libPaths() doesn't help.

  4. the Rprofile.site file is probably in the wrong directory, but putting it in an admin directory will mess with other apps


Question



How can I configure my shiny app to load shiny from a specific .libPath on startup?



Or have I mis-conceptualized the problem? Is there another way to go about this?










share|improve this question
















Problem



I'm deploying a Shiny App on a shiny server maintained by my university, and there are many .libPaths() that contain different versions of packages.



> .libPaths()
[1] "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4"
[2] "/nfs/admin/software/xenial/system-gcc/R_libs"
[3] "/usr/local/lib/R/site-library"
[4] "/usr/lib/R/site-library"
[5] "/usr/lib/R/library"


When my shiny app boots up, shiny is loaded by default from .libPaths()[2], which then imports R6 V.2.2.1, also from this path.



However, my code depends on R6 >= V.2.2.2, which I have in .libPaths()[1].



It would be simple enough to have my SysAdmin update R6 in .libPaths()[2], but they cannot because other people's apps depend on the libraries on that path, and we don't want to break those.




I've tried:




  1. detaching R6 and loading it from .libPaths()[1]



    detach("package:R6", unload=TRUE, force = TRUE, character.only = TRUE)
    library(R6, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  2. detaching shiny and loading it from .libPaths()[1]



    detach("package:shiny", unload=TRUE, force = TRUE, character.only = TRUE)
    library(shiny, lib.loc = "/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



  3. setting my .libPaths() from the start in the global.R file to only include the path I want.



    .libPaths(.libPaths()[1])



  4. adding an etc folder under "/zeolite/rpauloo/R" that contains the following Rprofile.site file (advice from here):



    .First <- function()
    .libPaths("/zeolite/rpauloo/R/x86_64-pc-linux-gnu-library/3.4")



None of these approaches work. Why?




  1. R6 is an attached package, so it can't be unloaded.

  2. not sure why unloading/reloading shiny doesn't work

  3. Shiny Server loads shiny from .libPaths()[2] to begin with, before the global.R file is sourced, so setting libPaths() doesn't help.

  4. the Rprofile.site file is probably in the wrong directory, but putting it in an admin directory will mess with other apps


Question



How can I configure my shiny app to load shiny from a specific .libPath on startup?



Or have I mis-conceptualized the problem? Is there another way to go about this?







r shiny shiny-server






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 17:44







Rich Pauloo

















asked Nov 14 '18 at 0:24









Rich PaulooRich Pauloo

2,153930




2,153930







  • 1





    Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

    – zacdav
    Nov 14 '18 at 0:53












  • @zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

    – Rich Pauloo
    Nov 14 '18 at 1:16






  • 1





    The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

    – zacdav
    Nov 14 '18 at 2:20












  • @zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

    – Rich Pauloo
    Nov 14 '18 at 17:30











  • Does the user that the shiny server is running as have read/write access to those paths?

    – zacdav
    Nov 14 '18 at 23:08












  • 1





    Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

    – zacdav
    Nov 14 '18 at 0:53












  • @zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

    – Rich Pauloo
    Nov 14 '18 at 1:16






  • 1





    The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

    – zacdav
    Nov 14 '18 at 2:20












  • @zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

    – Rich Pauloo
    Nov 14 '18 at 17:30











  • Does the user that the shiny server is running as have read/write access to those paths?

    – zacdav
    Nov 14 '18 at 23:08







1




1





Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

– zacdav
Nov 14 '18 at 0:53






Is the shiny server running as its own user? I believe you can alter the .libPaths() in global.R probably - however this still seems a bit hacky. Refer to: stackoverflow.com/questions/15170399/… Also maybe kb.iu.edu/d/avks?

– zacdav
Nov 14 '18 at 0:53














@zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

– Rich Pauloo
Nov 14 '18 at 1:16





@zacdav, thanks for taking a look. I've updated my question to reflect this. The problem is that when I update my .libPaths() in global.R to only include the ones I want, Shiny Server has already loaded shiny, and attached the old version of R6. I'm not sure what you mean by "running as its own user".

– Rich Pauloo
Nov 14 '18 at 1:16




1




1





The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

– zacdav
Nov 14 '18 at 2:20






The shiny server will be running on a server as a specific user, I believe that this dictates permissions and where it looks for packages by default. So one solution would be to have shiny server running for each user and each user can then maintain the packages as they wish - bit of a nightmare for someone managing it though. Additionally, Global.R is run before the server has initialised (at least I thought it was), so if the first line was updating .libPaths i'm surprised it didn't work.

– zacdav
Nov 14 '18 at 2:20














@zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

– Rich Pauloo
Nov 14 '18 at 17:30





@zacdav, yeah I also thought .libPaths(.libPaths()[1]) at the start of the global.R file would also work, but the error I get still indicates that shiny is loaded from .libPaths()[2] (I can tell because the version number). Maybe some .Rprofile or Rprofile.site file is running first and kick-starting this chain? I've updated the list of things I've tried.

– Rich Pauloo
Nov 14 '18 at 17:30













Does the user that the shiny server is running as have read/write access to those paths?

– zacdav
Nov 14 '18 at 23:08





Does the user that the shiny server is running as have read/write access to those paths?

– zacdav
Nov 14 '18 at 23:08












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291423%2fchange-default-loading-of-shiny-to-specific-libpaths-on-shinyserver%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291423%2fchange-default-loading-of-shiny-to-specific-libpaths-on-shinyserver%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin