Setting the python environment in a python chunk

I try to get familiar with python in R.
I made it work using reticulate along the following lines:

library(reticulate)
py_install("pandas")

Then I can always get back to the enviroment where I installed a given pacakhe using the command to change to the conda environment by

use_condaenv("r-reticulate")

How can I use this in a python chunk of the following form

```{python}
import pandas as pd
```

pandas can be found in the first version above (using reticulate) but not in the version with the python chunk. How can I tell it to use the "r-reticulate" environment? Setting it in an R set-up chunk in the following form does not work for me

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
use_condaenv("r-reticulate")
```

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.