Reticulate support improvements
A few working items for the next iteration of work in the Reticulate integration
- [ ] https://github.com/posit-dev/positron/issues/4870
- [ ] typing
exitat the python console freezes the session - [ ] It would be nice if shutting down the python repl returned focus to the R session.
- [ ] https://github.com/posit-dev/positron/issues/4887
- [ ] https://github.com/posit-dev/positron/issues/4869
- [ ] Support for reticulate in the Jupyter supervisor: https://github.com/posit-dev/positron/issues/4912
- [ ] https://github.com/posit-dev/positron/issues/4982
- [ ] Shutting down the Python kernel should restore the original sys.stdout and sys.stderr
- [ ] Shutting down the Python kernel should restore the original
sys.stdoutandsys.stderr
The supervisor itself is going to need to take on some work to be able to support connecting to an existing session for Reticulate. I've filed that here: https://github.com/posit-dev/kallichore/issues/8
I noticed that Positron, unlike RStudio, is unable to display matplotlib plot outputs (in R console). Is this an unexpected behavior, or is it intentional (as a unique feature of RStudio that is not supported in Positron)? Or could it be that I have some misconfiguration? Thank you for your work on Positron!
My reticulate is 1.41.
Hi, thanks for reporting.
Yes, reticulate does not currently integrate with the built-in Plots pane in Positron when running under the R Console.
Until this is implemented, you can workaround by using a different plotting device.
For example, install PyQt6, and use the external matplotlib graphics device it provides:
Sys.setenv("RETICULATE_PYTHON" = "managed")
library(reticulate)
py_require(c("matplotlib", "PyQt6"))
plt <- import("matplotlib.pyplot")
plt$plot(c(1, 2), c(3, 4))
plt$show()
Alternatively, you can switch to the Python Console to use the built-in Plots Pane.
By the way, I noticed in the screen shot you provided that the Variables Pane is not displaying reticulate variables correctly. You don't mention what version of Positron you're using, but if you install the latest Positron release and the development version of reticulate, the Variables Pane should have better support for reticulate objects.
pak::pak("rstudio/reticulate")
@t-kalinowski Thank you for your prompt response! Most of my work involves handling large amounts of data which can't be loaded without server through remote SSH, so this solution might not be very helpful for me. However, I find that using reticulate in Positron is much more stable than I initially expected! In fact, RStudio's support in this area is somewhat lacking (e.g., figure auto-resize, lack of high-resolution retina screen adaptation, etc.). It would be great if Positron could make further improvements in image clarity. Thank you!