In Rstudio 1.4 there is a global option for python interpreter. When I run a chunk of Python code in Rmd-file everything works fine with this interpreter. But when i try to knitr this Rmd-file to HTML the first chunk of Python-code fails with error:
Error: Installation of Python not found, Python bindings not loaded.
Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment.
Knitting happens in a clean R session that doesn't have your Python config. We should probably inject your Python config into that session; comment/upvote here:
opened 10:24PM - 29 Jan 21 UTC
closed 08:53PM - 10 Feb 21 UTC
bug
python
<!--
IMPORTANT: Please fill out this template fully! Failure to do so will resu… lt in the issue being closed automatically.
This issue tracker is for bugs and feature requests in the RStudio IDE. If you're having trouble with R itself or an R package, see https://www.r-project.org/help.html, and if you want to ask a question rather than report a bug, go to https://community.rstudio.com/. Finally, if you use RStudio Server Pro, get in touch with our Pro support team at support@rstudio.com.
-->
### System details
RStudio Edition :
RStudio Version : 1.4.1533
OS Version : Mac 10.15.17
R Version : 4.0.3
### Steps to reproduce the problem
1. Create a Python virtual environment.
2. In Project Options, tell RStudio to use the virtual environment as the active Python interpreter.
3. Install one or more Python packages.
4. Create an R Markdown document that emits the Python version via reticulate::py_config()
5. Knit the document and examine the Python version that shows in the viewer vs the output that shows in the console.
![Screen Shot 2021-01-29 at 3 09 58 PM](https://user-images.githubusercontent.com/1482677/106333218-6a436800-6245-11eb-8389-feb4b3c62f9b.png)
### Describe the problem in detail
It is confusing why those versions are not matching.
### Describe the behavior you expected
I would expect the versions of what shows in the source and console to match what is showing in the knitted document.
<!--
Please keep the below portion in your issue, and check `[x]` the applicable boxes.
-->
- [X] I have read the guide for [submitting good bug reports](https://github.com/rstudio/rstudio/wiki/Writing-Good-Bug-Reports).
- [X] I have installed the latest version of RStudio, and confirmed that the issue still persists.
- [ ] If I am reporting a RStudio crash, I have included a [diagnostics report](https://support.rstudio.com/hc/en-us/articles/200321257-Running-a-Diagnostics-Report).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Until that's fixed, you could work around it by adding the appropriate use_python
to your document's setup chunk.
Thank you for reply. Hope for fast fixing.
Wish granted! This change will shortly be available in our daily builds (v1.4.1556 or higher):
1 Like
system
Closed
February 27, 2021, 12:32am
5
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.