R package (httk) cannot be installed during deployment

Hi,

I have problems installing the R httk package, the error says the following:

Warning in install.packages(“httk”, repos = “http://cran.us.r-project.org”, :[2024-03-09 11:48:33.265139]

[2024-03-09 11:48:33.265586] ‘lib = “/usr/lib/R/site-library”’ is not writable

Error in install.packages(“httk”, repos = “http://cran.us.r-project.org”, :

unable to install packages

Execution halted

I have followed the instructions of @dataprofessor in his video: https://www.youtube.com/watch?v=xTfaJsn2PN0&t=6s

And, another person (@123_Gao) had the same problem that mine:

However, he didn’t provide code or something in order to know how he solved the problem.

The link to my github is: GitHub - PARODBE/streamlit_col_new

Also, another question, is that in my computer (locally) I have written the following to import rscript via subprocess:

pro=subprocess.Popen([‘C:\Program Files\R\R-4.3.1\bin\x64\Rscript.exe’, “httk.R”], text=True, shell=True)

pro.wait()

However, this works locally but not in streamlit cloud if I put some print() as a test, in that case, in the cloud, I have to put shell=False like the code of @dataprofessor:

pro=subprocess.Popen([‘C:\Program Files\R\R-4.3.1\bin\x64\Rscript.exe’, “httk.R”], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,shell=False)

pro.wait()

Please could you help me?

I had problems integrating R with Python before. My final solution was to use Docker, which is more flexible. Deploy Streamlit using Docker - Streamlit Docs

Thank you for your response @123_Gao, but did you try of modifying the lib such as @Goyo suggested you? Or did you implement It directly with docker? Do you have GitHub for seeing your code? Thanks

One question @123_Gao , if I build my app via docker, do I need to do something different with the R packages and the code? Do I need the packages.txt file, or how did you do It? And did you run your code via subprocess or via rpy2?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.