Cannot Install Rpy2 From Dependencies

I keep getting this error and I’m unsure how to fix it

Collecting rpy2==3.5.10

Downloading rpy2-3.5.10.tar.gz (215 kB)

 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 215.9/215.9 KB 261.3 MB/s eta 0:00:00[2023-03-09 20:27:39.275131] 

Installing build dependencies: started

Installing build dependencies: finished with status β€˜done’

Getting requirements to build wheel: started

Getting requirements to build wheel: finished with status β€˜error’

error: subprocess-exited-with-error

Γ— Getting requirements to build wheel did not run successfully.

β”‚ exit code: 1

╰─> [6 lines of output]

  Unable to determine R home: [Errno 2] No such file or directory: 'R'

  cffi mode is CFFI_MODE.ANY

  Looking for R home with: R RHOME

  Unable to determine R home: [Errno 2] No such file or directory: 'R'

  R home found: None

  Error: rpy2 in API mode cannot be built without R in the PATH or R_HOME defined. Correct this or force ABI mode-only by defining the environment variable RPY2_CFFI_MODE=ABI

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: subprocess-exited-with-error

Γ— Getting requirements to build wheel did not run successfully.

β”‚ exit code: 1

╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Here is my repo: GitHub - ananda-genentech/data-exploration-dashboard

Now this is the error I’m getting:

[21:12:40] 🐍 Python dependencies were installed from /app/data-exploration-dashboard/requirements.txt using pip.
Check if streamlit is installed
Streamlit is already installed
[21:12:41] πŸ“¦ Processed dependencies!

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.




2023-03-09 21:15:11.125 cffi mode is CFFI_MODE.ANY
2023-03-09 21:15:11.127 R home found: /usr/local/bin/R
2023-03-09 21:15:11.135 Unable to determine R library path: [Errno 2] No such file or directory: '/usr/local/bin/R/bin/Rscript'
2023-03-09 21:15:11.135 LD_LIBRARY_PATH: 
2023-03-09 21:15:11.137 Default options to initialize R: rpy2, --quiet, --no-save
cannot find system Renviron
Fatal error: unable to open the base package

Hey @ananda-genentech,

I forked and deployed your app and these are the error messages I got:

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.





2023-03-10 19:48:18.561 cffi mode is CFFI_MODE.ANY

2023-03-10 19:48:18.574 R home found: /usr/lib/R

2023-03-10 19:48:18.630 R library path: /usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server

2023-03-10 19:48:18.631 LD_LIBRARY_PATH: /usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server

2023-03-10 19:48:18.633 Default options to initialize R: rpy2, --quiet, --no-save

During startup - Warning messages:

1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :

  there is no package called β€˜ExpDes’

2: package β€˜ExpDes’ in options("defaultPackages") was not found 

/home/appuser/venv/lib/python3.9/site-packages/rpy2/rinterface.py:1110: UserWarning: R is not initialized by the main thread.

                Its taking over SIGINT cannot be reversed here, and as a

                consequence the embedded R cannot be interrupted with Ctrl-C.

                Consider (re)setting the signal handler of your choice from

                the main thread.

  warnings.warn(

2023-03-10 19:48:18.763 R is already initialized. No need to initialize.

2023-03-10 19:48:19.061 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/data-exploration-dashboard/pages/Homogeneity_of_Variance.py", line 6, in <module>

    from pages.hov.tabs.premodel import premodel_tab

  File "/app/data-exploration-dashboard/pages/hov/tabs/premodel.py", line 3, in <module>

    from pages.hov.functions.framework import chooseHOVTest

  File "/app/data-exploration-dashboard/pages/hov/functions/framework.py", line 9, in <module>

    expdes = rpackages.importr('ExpDes')

  File "/home/appuser/venv/lib/python3.9/site-packages/rpy2/robjects/packages.py", line 472, in importr

    raise PackageNotInstalledError(

rpy2.robjects.packages.PackageNotInstalledError: The R package "ExpDes" is not installed.

It seems like the problem might be related to not having β€œExpDes” installed.