I loaded the reticulate package, if it matters.
In a python script in R, the below commands work.
import numpy as np
import pandas as pd
But this one doesn't
import matplotlib.pyplot as plt
The console says : ModuleNotFoundError: no module named 'matplotlib'
In R's terminal I'm trying to do pip install matplotlib , but I get the error 'pip' is not recognized as an internal or external command, operable program or batch file.
I think you need to use the py_install function provided in the reticulate
package.
It should work: py_install(packages = "matplotlib")
In case you are using an virtual environment, try the virtualenv_install function.