Module not found in box.path #324
-
I am in a RNotebook and set the
The RNotebook is located in and run from a project sub-folder: If I try to load a module (
I get the following error: Error in box::use(R/Data_Import) :
unable to load module "R/Data_Import"; not found in
"/mnt/<...>/rstudio/rworkspace/projects/<project name>/modules/R",
"/mnt/<...>/rstudio/R/x86_64-pc-linux-gnu-library/4.2/box/mod",
"/mnt/<...>/rstudio/rworkspace/projects/<project name>/experiments/template"
(inside "find_in_path(spec, mod_search_path(caller))")
# I shortened the path a bit in-between `<...>`
# I also replaced the project folder name with `<project name>` I also tried I guess I miss something obvious. Any help or hints in the right direction would be highly appreciated. Many thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
When you are setting your module search path to Therefore, I suspect that your issue would be fixed if you adjust the module search path by removing the trailing In addition, I generally recommend to not use In your particular case, this means running the following code inside your R Notebook: options(box.path = box::file("../../modules")) In contrast to |
Beta Was this translation helpful? Give feedback.
When you are setting your module search path to
path/to/modules/R
and loading modules viabox::use(R/Data_Import)
, this means that the moduleData_Import
is searched in the pathpath/to/modules/R/R/
. Note the nestedR/R/
path!Therefore, I suspect that your issue would be fixed if you adjust the module search path by removing the trailing
"R"
.In addition, I generally recommend to not use
here::here()
with ‘box’, becausehere::here()
only works in very specific situations but fails in others. By contrast,box::file()
always gives you the correct location of the currently running code.In your particular case, this means running the following code inside your R Notebook: