JuliaCall icon indicating copy to clipboard operation
JuliaCall copied to clipboard

Automatic Installation of Julia?

Open ChrisRackauckas opened this issue 6 years ago • 19 comments

Kind of like Conda.jl, it would be nice if JuliaCall could install its own version of Julia.

ChrisRackauckas avatar Aug 25 '19 10:08 ChrisRackauckas

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?

Non-Contradiction avatar Aug 25 '19 15:08 Non-Contradiction

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?

Non-Contradiction avatar Aug 25 '19 16:08 Non-Contradiction

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.

ChrisRackauckas avatar Aug 25 '19 23:08 ChrisRackauckas

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?

Non-Contradiction avatar Sep 19 '19 23:09 Non-Contradiction

Sounds promising

ChrisRackauckas avatar Sep 20 '19 00:09 ChrisRackauckas

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.

spinkney avatar Mar 27 '20 12:03 spinkney

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.

ViralBShah avatar Apr 22 '20 23:04 ViralBShah

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:

  • Offer a function install_julia or whatever that needs to be called manually, in which case Julia is installed and that installation is used unconditionally
  • Try to do things automatically in .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.

christopher-dG avatar Aug 28 '20 17:08 christopher-dG

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.

ChrisRackauckas avatar Aug 28 '20 17:08 ChrisRackauckas

@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.

Non-Contradiction avatar Aug 28 '20 18:08 Non-Contradiction

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?

christopher-dG avatar Aug 28 '20 19:08 christopher-dG

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?

Non-Contradiction avatar Aug 28 '20 21:08 Non-Contradiction

Yes, I think it should remember the location.

ViralBShah avatar Aug 28 '20 21:08 ViralBShah

@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?

Non-Contradiction avatar Aug 28 '20 22:08 Non-Contradiction

Yes. Unless you override with environment variables, they will all pick it up from ~/.julia.

ViralBShah avatar Aug 29 '20 14:08 ViralBShah

How does one do conditional dependencies in R? I feel like putting install.packages in the source is a bad idea...

christopher-dG avatar Sep 01 '20 17:09 christopher-dG

Maybe the diffeq_setup function can open a specific environment? That would be more clean I guess.

ChrisRackauckas avatar Sep 01 '20 17:09 ChrisRackauckas

@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.

Non-Contradiction avatar Sep 01 '20 18:09 Non-Contradiction

@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.

Non-Contradiction avatar Sep 01 '20 19:09 Non-Contradiction