stefan-m-lenz / JuliaConnectoR

A functionally oriented interface for calling Julia from R
Other
100 stars 6 forks source link

Setting the Julia path when using JuliaConnector #29

Open SantiagoD999 opened 4 months ago

SantiagoD999 commented 4 months ago

Good morning,

I wanted to know how to set adequately JuliaConnectoR in R, I am using the Julia installation procedure through the terminal from https://julialang.org/downloads/ for Mac. I am trying to set the Julia executable path but the result from running in the terminal "which julia" gives me a path that is not accepted, therefore:

Sys.setenv(JULIA_BINDIR="/Users/san/.juliaup/bin/julia") produces this error after trying to run juliaEval :

Starting Julia ... Error in getJuliaExecutablePath() : No Julia executable file found in supposed bin directory "/Users/san/.juliaup/bin/julia"

I would appreciate any indication regarding how can I properly set JuliaConnectoR.

Thank you very much.

stefan-m-lenz commented 4 months ago

Good morning from me as well, the JULIA_BINDIR variable should point to the .../bin folder. You set it to the Julia executable itself. This is the problem. Sys.setenv(JULIA_BINDIR="/Users/san/.juliaup/bin") should work.

SantiagoD999 commented 4 months ago

Thank you for your reply, after running the code Sys.setenv(JULIA_BINDIR="/Users/san/.juliaup/bin") juliaEval("using Random; Random.seed!(2); rand(100)") I get:

Starting Julia ... Julia startup: ERROR: could not load library "/Users/san/.juliaup/bin/../lib/julia/sys.dylib" dlopen(/Users/san/.juliaup/bin/../lib/julia/sys.dylib, 6): image not foundError in runJuliaServer(multiclient = FALSE) : Timeout while waiting for response from Julia server

When I run in the terminal which julia I get:

/Users/san/.juliaup/bin/julia

Do you know why this may be happening?

stefan-m-lenz commented 4 months ago

It seems that using JULIA_BINDIR with juliaup doesn't work as I hoped because the julia executable used by juliaup is a different one than the previous Julia executable. I haven't used Juliaup before but it seems it has become the primary way of installaing Julia, so I might have to change the installation instructions in the package. Thank you for reporting this. I definitely need to clarify that JULIA_BINDIR does not work anymore in the way as described. However, for me it works if I use the JuliaConnectoR with juliaup on Windows if I don't set the JULIA_BINDIR variable. What is the output that you get when running julia on the command line? What is your output of which julia? Why is it not accepted? What is the error message? Could you please provide that information? I don't have a Mac so I can't reproduce you exact problem.

SantiagoD999 commented 4 months ago

Thank you very much for your reply.

What is the output that you get when running julia on the command line?

It directly opens the a julia command interface that lets me run julia code from my computer terminal.

What is your output of which julia?

/Users/san/.juliaup/bin/julia.

Why is it not accepted? What is the error message?

For example: Sys.setenv(JULIA_BINDIR="/Users/san/.juliaup/bin") juliaEval("using Random; Random.seed!(2); rand(100)")

Gives:

Starting Julia ... Julia startup: ERROR: could not load library "/Users/san/.juliaup/bin/../lib/julia/sys.dylib" dlopen(/Users/san/.juliaup/bin/../lib/julia/sys.dylib, 6): image not foundError in runJuliaServer(multiclient = FALSE) : Timeout while waiting for response from Julia server

In fact, when I just start running Julia in R (without setting manually JULIA_BINDIR) JuliaConnectoR works perfectly.

stefan-m-lenz commented 4 months ago

OK, so if you can use the JuliaConnectoR if you don't specify JULIA_BINDIR, the behaviour is the same as I observed on Windows. The problem is that if JULIA_BINDIR is set, Julia expects the folder structure that results from installing Julia directly from the official binaries instead of juliaup. So I have to update the documentation to make sure that this does not confuse other people. It is not necessary to set JULIA_BINDIR, only an option.