I am trying to execute a python script inside an rmarkdown document using bash. This is the code:
python 'path_to_file\file_to_execute.py' --net linear_nn --hid 10
The file requires both --net
and --hid
arguments to be specified.
When I execute the cell individually in RStudio I can see that it turns the expected output. However, when I go to knit the document (with the above chunk included) I get an error message as follows:
Error in engine(options) : /bin/bash: python: command not found Calls: ... process_group.block -> call_block -> block_exec -> in_dir -> engine In addition: Warning message: In system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) : running command '"bash" -c "python 'path_to_file\file_to_execute.py' --net polar --hid 10 "' had status 127 Execution halted
I have tried the approach of using bash
but perhaps that was not the right way to execute python files with arguments in rMarkdown. Would anyone know how to solve this problem so that I can knit the whole document without issue?