diff --git a/src/arulespy/arules.py b/src/arulespy/arules.py index 0ef393e..411b303 100644 --- a/src/arulespy/arules.py +++ b/src/arulespy/arules.py @@ -13,7 +13,9 @@ # install arules if necessary. Note: the system path is probably not writable for the user. # we try to create the directory so install.packages does not ask -ro.r('dir.create(Sys.getenv("R_LIBS_USER")[1], showWarnings = FALSE, recursive = TRUE)') +import os +os.makedirs(ro.r('Sys.getenv("R_LIBS_USER")')[0], exist_ok=True) +ro.r('.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()))') utils = packages.importr('utils') if not ro.packages.isinstalled('arules'): diff --git a/src/arulespy/arulesViz.py b/src/arulespy/arulesViz.py index c6d0e3a..cebbae3 100644 --- a/src/arulespy/arulesViz.py +++ b/src/arulespy/arulesViz.py @@ -14,7 +14,9 @@ # install arules if necessary. Note: the system path is probably not writable for the user. -ro.r('dir.create(Sys.getenv("R_LIBS_USER")[1], showWarnings = FALSE, recursive = TRUE)') +import os +os.makedirs(ro.r('Sys.getenv("R_LIBS_USER")')[0], exist_ok=True) +ro.r('.libPaths(c(Sys.getenv("R_LIBS_USER"), .libPaths()))') utils = packages.importr('utils') if not ro.packages.isinstalled('arulesViz'):