Shinyapps server doesen't find Python package (requests) while using reticulate

Hello!

I'm trying to publish an app to shinyapps.io.

It runs perfectly on my local machine, but when I deploy it to the server, I get a screen saying "An error has occured \n The application failed to start \n exit status 1".

The shinyapps.io logs say "Error in value[3L] : ModuleNotFoundError: No module named 'requests'".

Here is a minimal, reproducible example:

app.R

library(shiny)
library(reticulate)

source_python('test.py')

ui <- fluidPage(
  test_requests()
)

server <- function(input, output, session) {
}

shinyApp(ui, server)

teste.py

import requests 

def test_requests():
  response = requests.get('https://api.github.com')
  
  return response

Here is the full log:

Finally, R and packages versions on my local machine:

  • R: 4.1.1
  • shiny: 1.7.1
  • reticulate: 1.24