Run python code in .qmd file should be able to select interpreter
Currently, it is very confusing for users when they mixed R and Python code in a single .qmd file.
If only python code chunk, it will run in the system interpreter
If mixed with R code, it trigger the reticulate environment
As I don't want to use reticulate, but I want to still mix R and Python code, I found no way to do it. I even toggle off the setting "Use reticulate when run Python code chunk" but it doesn't help, which created a lot of confusions
If you want to mix R and Python code in the same Quarto document, unfortunately you do have to use the knitr engine and reticulate. This is a limitation of Quarto and not related to Positron; if you use a Jupyter engine, the mapping is "one engine per document" while knitr can handle Python via reticulate.
If you are looking for some best practices for using Python envs from R, I like this blog post by Emil Hvitfeldt: https://emilhvitfeldt.com/post/pyenv-for-r-packages/
It is written from the perspective of an R package developer but the same best practices can be applied to writing documents that mix R and Python. I do this a fair amount and I usually create a project-specific virtualenv that lives in the same directory as my mixed R-and-Python document.
Let us know if you have followup questions about using Quarto with multiple languages!