Open ChrisRackauckas opened 5 years ago
Yes, it would be nice if JuliaCall has a helper function to install Julia. For example, R package blogdown has a helper function to install Hugo https://bookdown.org/yihui/blogdown/installation.html.
It should be quite straightforward for JuliaCall to ask users if they want an automatic systemwide installation in interactive mode if a Julia installation cannot be found.
But by referring to "its own version of Julia", do you want to have the option for JuliaCall to install and use its own Julia even a Julia in system can be found? I'm not sure how to do this via R. Maybe Conda could be used?
Just have a somewhat related question: should JuliaCall remember the position of Julia it used last time (if any)? Currently JuliaCall doesn't remember this information, but I believe it could be done through certain mechanism. If JuliaCall remembers the position of Julia, then what should be the priority of this particular Julia?
But by referring to "its own version of Julia", do you want to have the option for JuliaCall to install and use its own Julia even a Julia in system can be found? I'm not sure how to do this via R. Maybe Conda could be used?
I was thinking of a Conda.jl-like solution, so yeah something that would default to just using its own install unless some environment variable is set at build.
I am attending an R conference at Stanford and hear about the miniconda in R at https://github.com/hafen/rminiconda. Maybe it could be utilized?
Sounds promising
any updates on this? writing a package that can use julia if the user wants. I'd like to have installation be automatic for the user.
Fixing https://github.com/JuliaPackaging/Yggdrasil/issues/321 is the key thing that needs to be done. The current issue is that we provide tarballs only on linux, but not on mac and windows, which makes it hard to automatically install Julia.
Once we update Julia buildbots to upload tarballs of binaries, it should be extremely easy to install Julia automatically on all the platforms.
After spending a bit of time learning how to write R code, I can offer some help on this now.
I think the two options we have are:
install_julia
or whatever that needs to be called manually, in which case Julia is installed and that installation is used unconditionally.onLoad
by checking for an existing installation, and if none is found then asking the user if they would like to have Julia installed automatically.Which is preferred? Any other ideas? If we can get a good description of how we want this to work I'm happy to do the coding bit.
I think a function is a good idea as a first step. Doing some fancy .onLoad thing could be added later, and it would likely use whatever install_julia
function anyways.
@christopher-dG Great! I agree with Christopher that a function would be a good first step.
Currently, julia is not automatically loaded during .onLoad
, so I think it can be a better way to add some fancy stuff to julia_setup()
after the function install_julia
is implemented and well tested.
Sounds good. Any thoughts on how to determine where to put the Julia installation and how to make this package remember it? Currently I just have install_julia(prefix)
AKA manually specifying where the installation should go, but it would be better if it were automatic and this package had a place it knew it could look for such a managed Julia install. Maybe something like appdirs would be of use?
This is a good question. I guess we can add the packages like rappdirs
for a (conditional) dependency.
A first step can be: if the user doesn't provide a path to install_julia
, then the package will install julia to a default place (in the non-interactive mode?) provided by rappdirs
, and we can also add something at the end (or beginning?) of the existing function JuliaCall:::julia_locate
, which will look for julia at this specific location when no julia is found (or should we look at here first?). After the implementation is completed, we can CI test it, although currently the CI test on windows appveyor is broken.
A related question is: should JuliaCall remember the location of the julia it used last time?
Yes, I think it should remember the location.
@ViralBShah Thanks for the opinion! This seems like a common practice in julia packages like RCall.jl
but not so common in R. But it could be really convenient and I can implement it in JuliaCall.
By the way, what will happen if the user has the same version of Julia at multiple places? Will they share the same environment/packages by default?
Yes. Unless you override with environment variables, they will all pick it up from ~/.julia.
How does one do conditional dependencies in R? I feel like putting install.packages
in the source is a bad idea...
Maybe the diffeq_setup function can open a specific environment? That would be more clean I guess.
@christopher-dG Conditional dependencies in R typically goes to the Suggestions section of the DESCRIPTION file. And in the specific function which depends on the package, you can use function require
to check if the package is installed, and give users some messages if the package is not installed.
@ChrisRackauckas Yes, I think it will make sense for a package to have a specific julia environment in some cases. But sometimes the user might also expect to have the corresponding julia packages in the global environment. One choice is to let users make their own choice. I'm also thinking about whether JuliaCall can do a similar thing, have its own environment if users make the choice. Or if JuliaCall can have some utility functions to manipulate julia environments.
Kind of like Conda.jl, it would be nice if JuliaCall could install its own version of Julia.