-
Notifications
You must be signed in to change notification settings - Fork 6
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
Better support for finding Julia executable when installed via Juliaup (on Mac) #30
Comments
Here's one attempt at implementing fallbacks via Juliaup in a small edit to getJuliaupJuliaPath <- function(juliaup_cmd = Sys.which("juliaup")) {
juliaup_config <- system2(juliaup_cmd, args = "api getconfig1", stdout = TRUE)
julia_bindir <- jsonlite::fromJSON(juliaup_config)$DefaultChannel$File
if (is.null(julia_bindir)) {
stop("Julia not found in path. Please check your Julia setup.")
}
julia_bindir
}
getJuliaExecutablePath <- function() {
juliaBindir <- Sys.getenv("JULIA_BINDIR")
if (juliaBindir == "") {
if (nchar(Sys.which("julia")) == 0) {
if (nchar(Sys.which("juliaup")) == 0) {
stop("Julia not found in path. Please check your Julia setup.")
} else {
# Fallback to Juliaup to find Julia if JULIA_BINDIR is unset and Julia cannot be found in PATH
juliaCmd <- getJuliaupJuliaPath()
}
}
juliaCmd <- "julia"
} else if (grepl(".juliaup", juliaBindir) && nzchar(Sys.which("juliaup"))) {
# If JULIA_BINDIR is via Juliaup, use Juliaup from that location to find the Julia executable
juliaCmd <- getJuliaupJuliaPath(file.path(juliaBindir, "juliaup"))
} else {
juliaExe <- list.files(path = juliaBindir, pattern = "^julia.*")
if (length(juliaExe) == 0) {
stop(paste0("No Julia executable file found in supposed bin directory \"" ,
juliaBindir, "\""))
}
juliaCmd <- file.path(juliaBindir, "julia")
}
return(juliaCmd)
} Lines 270 to 286 in d1bbefc
|
Thanks for your efforts. I'm currently at a conference and it will take a little time until I can fully dive into this. I see that this is a technical solution for finding the default Julia version set by juliaup. If the Julia executable is already in the PATH, as should be the case with juliaup, there is no need to set the JULIA_BINDIR variable at all. So are there scenarios where the Julia executable is not in the Path and you need to set it? |
Thank you for taking the time to review this issue out of your busy day. And I apologize for the confusion - I massively buried the lede on that most important point. Let me try this again.
This is true in theory and works in most contexts, including on my Windows - everything works fine out of the box. But...
Surprisingly, yes - it is entirely not uncommon, particularly on a Mac, for the value of This sets the stage for a frustrating set-up experience that I've witnessed from a couple Mac-user students that I've advised:
At this point: the user has two options:
In sum, in so far as Juliaup has become a primary way of managing Julia installations, it would benefit |
Thanks you very much for the detailed explanation and sharing your experiences. I do not have a Mac. So I personally can only evaluate the user experience on Linux and Windows. There I could not find any issues so I did not quite understand the inconveniences experienced by Mac users. As a first step, I updated the README. I would be thankful if you would take the time to review the installation section of the README from your perspective. I have another question regarding your proposed code above. You write a function As I understand your writing above, |
Yes, you're correct to note that there's no guarantee for
I wholeheartedly agree - I'm just uncertain about how to put Julia on PATH in such a way that it's guaranteed to show up everywhere (note that in our problem case, the users already see Julia in their PATH using the usual debugging methods). It would be ideal if the issue could be summarized concisely and if the fix is straightforward, but I haven't explored this much. My guess is that the simplest way to ensure an element of PATH is present in an R session is to modify
Thank you for this! I went off of what you currently have to make some edits and add some structure to the instructions. If have specific feedback I can polish this further. InstallationThe package requires that Julia (version ≥ 1.0) is installed and that the Julia executable is in the system search TroubleshootingAfter you have installed Julia, execute the command On Linux and Windows, the On Mac, Julia might not be on the Note about
|
Thanks you for working on the explanation text. I have thought about what is the most user-friendly experience. I could now also examine the behavior with a friend that has a Macbook. I think setting the path variable in R makes the most sense and users should be less guided to set the |
I'm now pursuing the following solution, which seems so far optimal to me as it adds only little complexity and provides the most user-friendly solution: After looking up the JULIA_BINDIR and the PATH variables and not finding Julia, I just look into the default installation directory of juliaup on Linux and Mac and use |
Thank you for these updates.
If it isn't too much trouble, that would indeed be a preferred way! I agree with pursuing the path of least resistance for the user, if it doesn't come at too much of a cost to maintanence
This also makes good sense to me! By the way, while we're on this topic, do you think you could consider exporting For example, one of my packages is If this is nontrivial and deserves more discussion, I can open a separate issue! |
Thanks for your feedback so far. |
Understood! Thanks for considering in any case |
I updated the code and the documentation. The only thing I'm currently struggle with is uploading the code coverage. I haven't gotten it to work with Codecov.io or Coveralls.io. I guess it is some issue with the tokens that I haven't figured out. Otherwise, I would consider the package update finished so far. |
Thank you! The
I've recently encountered this myself and I believe the fix at least in part involves updating the github actions yaml. I'll jog my memory on this and open a PR into the FixIssue branch - now at #31
Very happy to do so :) Thanks again for all your work on the package - it's been a blast building things on top of it. |
Thanks you very much for checking the update. I have figured out now what the issue with coverage was: I used the wrong token. Instead of the global one I needed to use the repository specific one. |
Glad to hear that that's been resolved! Looking forward to the new release :) |
Thank you for your persistence on this issue! The fix is released in the new version 1.1.4, which is also available on CRAN now. |
This concerns the behavior of
JuliaConnectoR:::getJuliaExecutablePath()
when the user has installed Julia via Juliaup, and see a path to Julia under Juliaup like/Users/XYZ/.juliaup/bin/julia
from runningSys.which("julia")
and/orwhich julia
in the terminal.As shown in #29, setting
/Users/XYZ/.juliaup/bin
toJULIA_BINDIR
returns the error even whenjulia
exists in the directory, as/Users/XYZ/.juliaup/bin/julia
is a symlink to the default Julia executable used by Juliaup, and it's only in that original location is where contents like/lib
can be found (hence thecannot load ".../lib/julia/sys.dylib"
error in #29).1It would be very convenient for users new to Julia if
{JuliaConnectoR}
could automatically handle paths to the Julia executable used by Juliaup (i.e., discover the original executable from.../.juliaup/bin
).Some initial findings from my investigation (but on a single Mac, so may not generalize):
.../.juliaup/bin/julia
, the Juliaup executable itself is also in that directory:.../.juliaup/bin/juliaup
juliaup api config1
returns a JSON of contents injuliaup status
, which includes the path to the default version of Julia that Juliaup uses.../.juliaup/bin/julia
) is atjsonlite::fromJSON(juliaup_config_json)$DefaultChannel$File
JULIA_BINDIR
to where that Julia executable is makesJuliaConnectoR::startJuliaServer()
run successfullyHappy to assist in any way I can!
Some code:
Note that because this leans on the existing Juliaup setup to find the executable, the Julia version called by
{JuliaConnectoR}
is guaranteed to be in sync with the default Julia version of Juliaup.Footnotes
On a separate note, the proposed solution in Setting the Julia path when using JuliaConnector #29 (of leaving
JULIA_BINDIR
unset) actually does not seem to not work in my case, asSys.which("julia")
returns empty even thoughwhich julia
says otherwise - this discrepancy is known in Macs (see refs 1, 2). In those cases, a combination of the fix for this issue + encouraging users to setJULIA_BINDIR
manually to.../.juliaup/bin
should suffice. ↩The text was updated successfully, but these errors were encountered: