Python Environment Restore

I am experiencing an issue with RStudio Connect documents that rely on python. There appears to be inconsistencies with the Python Environment Restore functionality. In the logs of my documents that are failing it is trying to run one python executable some of the time and a different python executable other times.

Here are some logs and configurations. When the document fails I see this:

08/28 11:29:57.889
Running with python “3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]” at /usr/bin/python3.6
08/28 11:29:57.889
Running as user: rstudio-connect
08/28 11:29:57.889
The python installation at /usr/bin/python3.6 was expected to have version 3.6.7 but is reporting version 3.6.8; the Python installation may have changed. RStudio Connect needs to be restarted. Please contact the server administrator.

When the document is successful I see this:

08/28 07:35:07.755
Running with python “3.6.8 (default, Aug 26 2019, 16:56:45) [GCC 7.4.0]” at /opt/Python/3.6.8/bin/python3.6
08/28 07:35:07.756
Running as user: rstudio-connect
08/28 07:35:07.770
Using cached environment: 0WGGkSRuxhQTsrhgja3AgQ
08/28 07:35:10.719
Packages in the environment: pycrypto==2.6.1,

Here is my python config:

Enabled = true
;Executable = /opt/Python/3.7.1/bin/python3
;Executable = /usr/bin/python3
Executable = /opt/Python/3.6.8/bin/python3

I recently rebuilt python 3.6.8 from source as suggested in the admin guide and pointed to it rather than the python in the /usr/bin path. I think a few days ago the server that is running our rstudio connect must have switched python versions from 3.6.7 to 3.6.8. RStudio Connect must be holding onto some 3.6.7 config in cache or something? I ran the migrate rebuild packrat/clear cache last night (sudo /opt/rstudio-connect/bin/migrate rebuild-packrat --force). Still seeing the same issue today. Has anyone run across this behavior and know a fix?

Additionally, when the document fails for a python environment restore issue it DOES NOT send an email notifying the owner that the document failed to render.

Hi @cfrisby,

Thanks for the information and for trying out the Python functionality in Connect.

We have seen this issue with older versions of RStudio Connect or when a certain compiler flag is missing when you install Python from source. What version of RStudio Connect are you using?

Take a look at the Mismatched / expected version errors when using Python installed from source section in the following support article and see if either upgrading to the latest version of RStudio Connect or including that additional --disable-new-dtags compiler flag fixes things for you:

Feel free to get in touch with our support team if you continue to have problems with your Python deployments in Connect.