After I discovered reticulate, I like to use RMarkdown to write my documents that has Python code. Everything works as expected when I need to convert my .Rmd file with Python code to a .html file. Unfortunately, I'm facing challenges during the process of writing the document and test Python code chunk. If I have the following .Rmd document
I can use the "Run Current Chunk" feature of RStudio without problem for the first chunk but not the second. The second chunk gives me
Traceback (most recent call last):
File "/tmp/Rtmpa7PXBX/chunk-code4bf337ad4e99.", line 1, in <module>
import pandas
ModuleNotFoundError: No module named 'pandas'
I have panda installed in the r-reticulate environment, the one used when converting from .Rmd to .html. Any work around?
If you have two versions of python in your system reticulate uses the default version (maybe 2.7) and if pandas is not installed under that version you cant use it.
Try to explicitly specify your python engine, similar to this.