Installing github packages for deployment

I am using rpy2 to wrap R in Python. I used R for plotting the CONSORT diagram with packages installed with devtools::install_github(“tgerke/ggconsort”). How can I put this in the packages.txt for deployment?

Link to the app

Hi @ruby9455

I’ve created a tutorial showing how to install R packages in a Streamlit app by specifying that in the packages.txt file. Please see the GitHub repo GitHub - dataprofessor/R-Python-app

Here’s a companion tutorial video

Demo app:

Hope this helps!


I’ve watched the tutorial which is pretty useful. I am able to specify those cran packages, however, I could not specify those packages that are installed from github. The packages that I am struggling on is that installed with devtools::install_github(“tgerke/ggconsort”).

Currently, my packages.txt looks like this

Hi @ruby9455

Conceptually, putting R package names into packages.txt file is like installing these R packages like so:

sudo apt install r-base r-cran-ggplot2

As for installing R packages via devtools, this would need to be run inside an R environment.

Please see the following tutorial on installing R dependencies:

which can also be placed inside the packages.txt file. However, when running devtools you’ll probably need to run this from within an R environment as mentioned above. Since this would not be practical, the workaround is to run the command from the shell/terminal.

Thus, I’d recommend exploring the following commands:

R -e
Rscript -e

to run the devtools::install_github(“tgerke/ggconsort”) as you had intended.

Hope this helps!