Error Deploying to Connect when using reticulate

I am trying to deploy a very simple proof-of-concept Rmarkdown doc to Connect, that uses the reticulate package. However, I'm getting the following error when deploying a Rmarkdown document to connect (using the Quick Start):

* reticulate is in use, but python was not specified
Execution halted

My setup R chunk is:

library(ggplot2, quietly = T)
library(reticulate)
reticulate::use_virtualenv(virtualenv = "r-reticulate")

And then I have a python chunk:

import pandas as pd
import numpy as np

I previously had some trouble getting this to run locally, which was resolved by updating the reticulate package to v1.9.
https://stackoverflow.com/questions/54836065/not-able-to-import-python-modules-in-rmarkdown/54870719#54870719

Thanks for the feedback on using Python with RStudio Connect in the QuickStart!

When deploying Python content to RStudio Connect, we recommend using the RETICULATE_PYTHON environment variable instead of the reticulate::use_* functions for a couple of reasons:

  1. It keeps you from having to switch between paths and Python environments on your local machine vs. when deploying to RStudio Connect.

  2. When using push-button deployments from the RStudio IDE to RStudio Connect, it tells the rsconnect library that Python is in use (per your error). Otherwise, you would need to invoke the rsconnect deployment commands manually vs. using the push-button deployment functionality.

You can set the RETICULATE_PYTHON environment variable in your .RProfile or any other method, then you should be able to deploy your sample R Markdown document.

Refer to the support article on Using Python with RStudio Connect for more information, specifically the section on How can I configure reticulate to point to a specific Python environment?

Thank you for the speedy reply. I've tried setting the Reticulate_Python environment variable to my python environment using Sys.setenv(RETICULATE_PYTHON = "~/.virtualenvs/r-reticulate/bin/python3").

I've tried deploying my doc again, as well as an example from https://github.com/sol-eng/python-examples, and I get the same error in the detailed deployment log:

Build error: Unable to find a compatible version of Python: No known installation matching major.minor version of 3.6.7

I'm not sure what this means. I've double checked my python environment does work using the interactive command line.

Any ideas?

A new error message is a good thing, it means you have made some progress! :slight_smile:

It appears that your RStudio IDE and rsconnect are properly publishing the app and indicating that it has Python content, but Python is not installed on the RStudio Connect server, which in this case is the QuickStart VM.

You could install Python from source per the RStudio Connect admin guide, or...

If you downloaded the QuickStart more than a week or so ago, we actually published a new version of the QuickStart VM that has Python 3.7 already installed and a few sample apps with Python content already deployed.

So, you can re-download the latest version of the QuickStart VM from https://www.rstudio.com/products/quickstart/, start it up, and then you should be able to deploy your Python content to RStudio Connect.

Hmm, I just downloaded the VM again from your link and I don't see any python apps. Also, I see python2.7 and python3.6 installed, but no 3.7. Is this the correct link?

Apologies! We had an error in the new download form that was not pointing to the correct download link. We've updated the form now such that it will always point to the latest download link, so you can try downloading again.

The latest version of the QuickStart is rstudio-quickstart-18.04-amd64-20190209-111823.ova, which contains Python examples and has Python 3.7.1 installed in /opt/Python/3.7.1 with RStudio Connect pre-configured to use it.

1 Like

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.