Publishing to ShinyApps.io with Python3

Hi everyone,

I am trying to publish a shinyApp with Python3 to shinyApps.io. According to this post, I added the code below on my App.R file.

virtualenv_create('pyDev',python = 'python3')
virtualenv_install("pyDev", packages = c('gensim', 'pandas','numpy','nltk','paramiko'))
reticulate::use_virtualenv("pyDev", required = TRUE)

However, when I publish the app, I got the following error:

Required version of Python '~/.virtualenvs/pyDev/bin/python' cannot be used because another version of Python ('/usr/bin/python') is already initialized for this process.
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>

However, I can still open the published application, but it will "disconnect from server" whenever it tries to run python codes.
I checked the log and the app is actually still running on Python2.7. Anyone know how to resolve this? Thanks in advance, I appreciate your help.

Marshal

1 Like

Hi @Marshal, did you also trying installing this version of rsconnect (before deploying)?

devtools::install_github("rstudio/rsconnect", ref='737cd48')

Regardless, it'd would be great if you could also report this issue here https://github.com/rstudio/rsconnect

Hi @cpsievert,

Thanks for replying. Yes, I tried. Without it there is another error. Sure, I am happy to post the issue.

1 Like

Hello. I am having the same problem exactly. Did you succeed in running python3? Thank you.

Hi there,

No. Unfortunately it still remains unsolved.

Thank you. For the record, I have also been trying another approach mentioned around with use_python(), with no luck either. Yet, Python3 seems to be there, one can get the path using which.