Q: Airflow: Package installation to Execute RScripts in Airflow Requirement: To execute RScripts via Airflow
Airflow Version : 2.3.3 in EKS
Tried installing python3 -m pip install rpy2 via DockerFile, Below is the error description
Error :
Collecting rpy2
#5 90.44   Downloading rpy2-3.5.6.tar.gz (211 kB)
#5 91.03   Installing build dependencies: started
#5 107.7   Installing build dependencies: finished with status 'done'
#5 107.7   Getting requirements to build wheel: started
#5 108.3   Getting requirements to build wheel: finished with status 'error'
#5 108.3   error: subprocess-exited-with-error
#5 108.3
#5 108.3   × Getting requirements to build wheel did not run successfully.
#5 108.3   │ exit code: 1
#5 108.3   ╰─> [6 lines of output]
#5 108.3       Unable to determine R home: [Errno 13] Permission denied: 'R'
#5 108.3       cffi mode is CFFI_MODE.ANY
#5 108.3       Looking for R home with: R RHOME
#5 108.3       Unable to determine R home: [Errno 13] Permission denied: 'R'
#5 108.3       R home found: None
#5 108.3       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
#5 108.3       [end of output]
#5 108.3
#5 108.3   note: This error originates from a subprocess, and is likely not a problem with pip.
#5 108.3 error: subprocess-exited-with-error
#5 108.3
#5 108.3 × Getting requirements to build wheel did not run successfully.
#5 108.3 │ exit code: 1
#5 108.3 ╰─> See above for output.
#5 108.3
#5 108.3 note: This error originates from a subprocess, and is likely not a problem with pip.
------


A: Resolved with the below inclusion in the DockerFile
RUN apt-get update && apt-get install -y r-base r-base-core && \
    rm -r /var/lib/apt/lists/*
RUN python3 -m pip install rpy2

