[R] Problem to run python code in r markdown

Kai Yang y@ngk@|9999 @end|ng |rom y@hoo@com
Fri Jan 20 17:20:15 CET 2023


Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below:

try Python=============
```{r, include=FALSE, echo=TRUE}library(reticulate)py_install("numpy")
use_condaenv("base")
```
```{python}import numpy as np```

I got error message below:
Error in py_call_impl(callable, dots$args, dots$keywords) :   ModuleNotFoundError: No module named 'numpy'Calls: <Anonymous> ... py_capture_output -> force -> <Anonymous> -> py_call_implIn addition: There were 26 warnings (use warnings() to see them)Execution halted


Based on message, the python can not find numpy package. But I'm sure I installed the package. I don't know how to fix the problem. please help
Thank you,Kai















	[[alternative HTML version deleted]]



More information about the R-help mailing list