I'm working on a python application using Eel framework and I'm using the python subprocess library to execute an R script. It works completely fine on my computer, but not in any other computer since it doesn't have R installed (and obviously R will not be in the PATH).
I'm wondering if there is a way to bundle the entire R with my python exe so its a completely independent application and doesn't require the client to have R installed + to have R in the PATH.
Here is where I call my R script from python:
rScript = resource_path("map.R")
retValue = subprocess.check_output(["Rscript", '--vanilla', rScript, finalDirectory],
shell=True, universal_newlines=True)
Here is the pyinstaller command:
python -m eel flight_checker.py web --icon=web\drone.png --add-data "map.R;."
I really appreciate any help provided.
Posting my solution in case anyone falls into the same issue:
I ended up bundling the whole R by executing this pyinstallter command:
python -m eel flight_checker.py web --add-data "map.R;." --add-data "C:\Program Files\R;." --icon=web\drone.ico --clean
Notes:
C:\Users\CURRENT_USER\PATH_TO_YOUR_PROJECT\dist\PROJECT_NAME\R-4.2.1\library
Hope that helps.