Knitting Python Code in R Markdown file crashes if calling plotnine or deploy...

am learning RStudio for a business school course that requires coding in both R and Python.

I am using the "Reticulate" library (based on the miniconda package) to use Python.

My R and Python all code works fine in RStudio. However, when I try to Knit the Notebook file (to any output type, html, Word, etc.), only the R code will work. As soon as the Knit function encounters a call to the plotnine or dfply like:

(ggplot(data = r.diamonds, 
  mapping=aes(x='carat', y='price', color = 'color')) 
  + geom_point()
)  

I get the following errors, and knitting execution fails:


Quitting from lines 23-27 (kint_test_4.Rmd)
Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: TypeError: type object got multiple values for keyword argument 'visible'

Detailed traceback:
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\pyplot.py", line 838, in clf
gcf().clf()
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\figure.py", line 1795, in clf
ax.cla()
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\axes_base.py", line 1051, in cla
self.xaxis.cla()
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\axis.py", line 788, in cla
self.reset_ticks()
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\axis.py", line 811, in reset_ticks
self.set_clip_path(self.axes.patch)
File "C:\Users\walam\AppData\Local\R-MINI~1\envs\R-RETI~1\lib\site-packages\matplotlib\axis.py", line 901, in set_clip_path
for child in self.m
Calls: ... py_capture_output -> force -> -> py_call_impl
Execution halted

Simple Python code like
Print("Hello World!")
runs fine. It's the calls to plotnine or deploy that case the problemm.

I'm just plain stuck trying to debug this.

Any Suggestions?

Thanks in advance for any help,

Bill

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.