-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move R code into hera
#130
base: main
Are you sure you want to change the base?
Conversation
… and calling the configure function. The package will deal with loading the R code
Thanks @SylvainCorlay for the ☎️ hints, I'll resume later, but one thing we can do perhaps is to make the files with
|
That's great. I think we should be able to get away with that without publishing hera until it fuly stabilises. |
I've added R CI with a tweaked |
For me to be happy about merging, let me just check that the R functions that are currently called from the |
I think it's good for now. We'll probably need to export/document the classes in the comm.R file later, but this is a pretty big PR already. Will Follow up. |
Has it been verified that it works with JupyterLite? Or should I test it? |
I don't think it has. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @romainfrancois ! I like where this is going, but to make it compatible with Emscripten we still need to make some changes.
In FindR.cmake
find_program(R_COMMAND R DOC "R executable.")
find_program(R_SCRIPT_COMMAND Rscript DOC "Rscript executable.")
These variables will point to the executables in the wasm environment, but we cannot execute them directly because they're JavaScript files. So we cannot use these to build hera
.
When we cross-compile other R packages, we rely on cross-r-base
. But this requires overwriting some files in PREFIX
. I don't have a good solution yet, but I'll give it some more thought.
# ====================== | ||
|
||
message(STATUS "Installing R 📦 hera to ${R_HOME}/library") | ||
execute_process(COMMAND ${R_COMMAND} CMD INSTALL --preclean --no-staged-install --build ../hera) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command should have failed for the Emscripten build
-- Installing R 📦 hera to /home/runner/micromamba/envs/xeus-r-wasm-host/lib/R/library
/home/runner/micromamba/envs/xeus-r-wasm-host/lib/R/bin/R: line 279: /home/runner/micromamba/envs/xeus-r-wasm-host/lib/R/bin/exec/R: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/lib/R/bin/R: line 279: exec: /home/runner/micromamba/envs/xeus-r-wasm-host/lib/R/bin/exec/R: cannot execute: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/bin/Rscript: 1: //: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/bin/Rscript: 2: //: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/bin/Rscript: 3: //: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/bin/Rscript: 4: //: Permission denied
/home/runner/micromamba/envs/xeus-r-wasm-host/bin/Rscript: 5: Syntax error: "(" unexpected
Maybe we can add a result variable to make sure it fails when the command doesn't work
execute_process(COMMAND ${R_COMMAND} CMD INSTALL --preclean --no-staged-install --build ../hera
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "Command failed with return code ${result}")
endif()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started some workarounds here https://github.com/IsabelParedes/xeus-r/tree/pr-hera
It builds hera
for the wasm environment, but the internal packages in R base still need to be restored to their original state.
This is early stage. Probably does not work yet. I'll keep going tomorrow.
This will be much cleaner because the way we structured the code previously in xeus-r was essentially mimicing what an R package does, but not as good.