Reticulate sample notebook - R from Python not working on RSConnect

I'm trying to deploy the rmarkdown notebook from python-examples/rmarkdown-notebook at master · sol-eng/python-examples · GitHub

This knits fine on my local Windows machine.

However, on the connect server it fails when reaching the python block that tries to access the R object... line 59 - python-examples/rmarkdown-notebook.Rmd at 4fe03120c348eb7f98c15cd232dbbddca26f167e · sol-eng/python-examples · GitHub

'''{python print}
print(r.flights.head(10))
'''

The error shown is:

label: print (with options)
List of 1
$ engine: chr "python"

Quitting from lines 64-65 (FirstAttempt.Rmd)
Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: object 'flights' not found.

My Connect config is:

RStudio Connect v1.8.0.4-21
Build "869d03a"

Available R Versions:

  • 4.0.2
  • 3.6.3

Available Python Version:

  • 3.6.9

I believe this should be an OK configuration to run this basic reticulate sample on...

I'm not too sure how to debug this.... anyone got any suggestions of where to look?

Could you try updating to the latest version of reticulate from Github and deploying again? We've observed this problem before with the current CRAN version of reticulate.

Thanks!

1 Like

I've tried... and it caused a few other dependency issues...

I've been fighting:

[Connect] 2021/03/26 17:45:21.021136501 The command failed with output:
[Connect] 2021/03/26 17:45:21.021139398 ERROR: dependency ‘withr’ is not available for package ‘reticulate’

even though both reticulate and withr are in my manifest file....

..

eventually gave up and went back to reticulate 1.16 on CRAN - that works - so it is something about the latest reticulate on CRAN!

Thanks... will try the github head version one day next week.