fix the reticulate error ModuleNotFoundError #1

Closed
LucileSol wants to merge 1 commit from dev_lucile into main
LucileSol commented 2025-11-21 12:26:40 +00:00 (Migrated from github.com)

This is a fix for the error :

Error in `py_call_impl()`:! ModuleNotFoundError: No module named 'requests'Run `reticulate::py_last_error()` for details.Backtrace: ▆ 1. └─global .main() 2. └─execute(...) 3. └─rmarkdown::render(...) 4. └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) 5. └─knitr:::process_file(text, output) 6. ├─xfun:::handle_error(...) 7. ├─base::withCallingHandlers(...) 8. └─knitr:::process_group(group) 9. └─knitr:::call_block(x) 10. └─knitr:::block_exec(params) 11. ├─knitr:::in_input_dir(engine(options)) 12. │ └─knitr:::in_dir(input_dir(), expr) 13. └─knitr (local) engine(options) 14. └─reticulate::eng_python(options) 15. └─reticulate:::py_compile_eval(snippet, compile_mode) 16. ├─reticulate::py_capture_output(...) 17. │ ├─base::tryCatch(...) 18. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 19. │ └─base::force(expr) 20. └─builtins$eval(compiled, globals, locals) 21. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)Quitting from timeLog.qmd:106-145 [unnamed-chunk-1]
This is a fix for the error : ``` Error in `py_call_impl()`:! ModuleNotFoundError: No module named 'requests'Run `reticulate::py_last_error()` for details.Backtrace: ▆ 1. └─global .main() 2. └─execute(...) 3. └─rmarkdown::render(...) 4. └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) 5. └─knitr:::process_file(text, output) 6. ├─xfun:::handle_error(...) 7. ├─base::withCallingHandlers(...) 8. └─knitr:::process_group(group) 9. └─knitr:::call_block(x) 10. └─knitr:::block_exec(params) 11. ├─knitr:::in_input_dir(engine(options)) 12. │ └─knitr:::in_dir(input_dir(), expr) 13. └─knitr (local) engine(options) 14. └─reticulate::eng_python(options) 15. └─reticulate:::py_compile_eval(snippet, compile_mode) 16. ├─reticulate::py_capture_output(...) 17. │ ├─base::tryCatch(...) 18. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 19. │ └─base::force(expr) 20. └─builtins$eval(compiled, globals, locals) 21. └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)Quitting from timeLog.qmd:106-145 [unnamed-chunk-1] ```
bsennblad (Migrated from github.com) reviewed 2025-11-21 12:26:40 +00:00
bsennblad commented 2025-11-21 15:29:02 +00:00 (Migrated from github.com)

I have implemented this (as you shared it with me on slack) to a new version that also implement:

  • placing all params ina separate timeLogParams.yml file
  • solution to the user list with single item crashing the script
  • solution so that if an empty user list is provided this is interpreted as give me all users that have logged time.
    I am currently ironing out the last quirks relating to the laste item above -- it is such a large number of users that it becomes slow to debug.
    Because of this, I will reject your PR as your solution will be implemented very soon anyway.

As an additional piece of info, I talked to Roy just now. He recommends not using the reticulate R-package for mixing R and python, because the large number of side-effects. SO a future plan might be to convert the R-chunks to Python chunks.
Have a nice weekend

I have implemented this (as you shared it with me on slack) to a new version that also implement: - placing all params ina separate timeLogParams.yml file - solution to the user list with single item crashing the script - solution so that if an empty user list is provided this is interpreted as give me all users that have logged time. I am currently ironing out the last quirks relating to the laste item above -- it is such a large number of users that it becomes slow to debug. Because of this, I will reject your PR as your solution will be implemented very soon anyway. As an additional piece of info, I talked to Roy just now. He recommends not using the reticulate R-package for mixing R and python, because the large number of side-effects. SO a future plan might be to convert the R-chunks to Python chunks. Have a nice weekend

Pull request closed

Sign in to join this conversation.
No description provided.