Plumber + Future + Python

Dear Community,
I am building a plumber api that I use in some future sections.

In one of these sections I use functions that are written in python and every time I insert this python function inside a future::future({}) it crashes the process and gives me this output

Lazy evaluation: FALSE
Asynchronous evaluation: TRUE
Local evaluation: TRUE
Environment: 0x0000020e567bf2e8
Capture standard output: TRUE
Capture condition classes: 'condition' (excluding 'nothing')
Globals: 18 objects totaling 2.31 MiB (standardGeneric 'dbConnect' of 10.29 KiB, environment 'req' of 1.11 MiB, function '%>%' of 7.47 KiB, function 'check_interval' of 15.10 KiB, function 'satellite_vegetation_indexes_editing' of 334.50 KiB, ...)
Packages: 11 packages ('stringr', 'rpostgis', 'sf', 'dplyr', 'RColorBrewer', 'utils', 'raster', 'nasapower', 'rgeos', 'tidyr', 'reticulate')
The Ecuyer-CMRG RNG seed: <none> (seed = FALSE)
Resolved: TRUE
Value: <not harvested
Condition captured: <none>
Early reporting: FALSE
Proprietary process: c4878bce-0dbd-e66e-83c9-ab9e199f703e
Class: 'MultisessionFuture', 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment'

DEBUG: END OF TROUBLESHOOTING GUIDE

as also reported in this PLumber + Future + Fastsam.

so my question is:
Can I use future with a function written in python?

Moreover now i have added to the future section all the necessary part to execute the code

 reticulate::use_python("C:/Program Files/Python310")
      
      source("functions_new.R")
      
      reticulate::source_python('predict_sam.py')
      reticulate::source_python('sentinel_elab.py')
      
      library(tidyverse)
      library(plumber)
      library(reticulate)
      library(jsonlite)
      library(DBI)
      library(sp)
      library(readxl)
      library(rgeos)
      library(raster)
      library(RPostgreSQL)
      library(sf)
      library(rpostgis)
      library(Rook)
      library(rgdal)
      library(rapidoc)
      library(NbClust)
      library(future)
      library(planetR)
      library(data.table)
      library(nasapower)
      library(owmr)
      library(gptstudio)
      library(RPostgres)
      library(httr)
      library(lubridate)
      library(promises)
      library(sen2r)
      library(shinyjs)
      library(emayili)
      library(geojsonsf)
      library(SPEI)
      library(RColorBrewer)
      library(mapview)
      library(echarts4r)
      library(base64enc)
      library(reshape2)
      library(soilDB)

and now i am getting this

<Rcpp::exception in eval(expr, p): KeyError: 1
>

I do not have an answer for this one yet, but I like your motivation to keep going forward, asking for help and participating in the community. It's inspiring!

This topic was automatically closed 42 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.