Skip to content

Commit

Permalink
Documentation of Julia setup
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-m-lenz committed Sep 27, 2024
1 parent 0f192c4 commit 184037f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 25 deletions.
41 changes: 34 additions & 7 deletions R/JuliaConnectoR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,41 @@ NULL
#'
#' Julia must be installed separately from the \pkg{JuliaConnectoR} package.
#' You can download and install Julia from \href{https://julialang.org/downloads/}{https://julialang.org/downloads/}.
#' After the installation, ensure that the Julia executable is in the system search \env{PATH} or that the
#' \env{JULIA_BINDIR} environment variable is set to the \code{bin} directory of
#' the Julia installation.
#'
#' \subsection{Setup via the Juliaup installation manager}{
#' If you have installed Julia via Juliaup,
#' the Julia installation should be discovered by the \pkg{JuliaConnectoR}.
#' }
#'
#' \subsection{Juliaup on Windows}{
#' On Windows, if you have freshly installed Juliaup, start Julia once on the command line.
#' This will do the actual installation of the current Julia version.
#' Juliaup puts the Julia executable on the system \env{PATH}.
#' This way, the Julia installation can be detected by the \pkg{JuliaConnectoR}
#' }
#'
#' \subsection{Juliaup on Mac}{
#' After the installation of Juliaup, it might not be on the system \env{PATH}
#' but it should be discovered automatically
#' if it is installed in the default location, i.e., the \code{.juliaup}
#' folder in your home directory.
#' }
#'
#' \subsection{Setup via Julia binaries}{
#' If you have installed Julia via a binary package or any other method,
#' the simplest way to make Julia discoverable is by adding the directory
#' containing the Julia executable to the \env{PATH} environment variable.
#'
#' Alternatively, you can set the \env{JULIA_BINDIR} environment variable
#' to specify the exact directory containing the Julia binary.
#' (You can find the correct path to this directory by evaluating the expression
#' \code{Sys.BINDIR} within Julia.)
#'
#' If the \env{JULIA_BINDIR} variable is set, it takes precedence over
#' looking in the executable path.
#' By setting the \env{JULIA_BINDIR} variable before starting Julia,
#' it is therefore possible to use different installations of Julia on the
#' same machine without having to change the executable path.
#' looking up the system \env{PATH}.
#' This makes it easy to use a different Julia version
#' than the one in your system \env{PATH}.
#' }
#'
#' @name Setup-JuliaConnectoR
NULL
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,11 @@ Or the development version can be installed with:

devtools::install_github("stefan-m-lenz/JuliaConnectoR")

The package requires that [Julia (version ≥ 1.0) is installed](https://julialang.org/downloads/) and that the Julia executable is in the system search `PATH` or that the `JULIA_BINDIR` environment variable is set to the `bin` directory of the Julia installation.
The package requires that [Julia (version ≥ 1.0) is installed](https://julialang.org/downloads/).
If Julia is installed with Juliaup, it should be discovered successfully.
Otherwise, make sure your Julia installation is on the system `PATH` or set the `JULIA_BINDIR` system variable.
More information on that can be found in the [latest documentation](https://github.com/stefan-m-lenz/JuliaConnectoR/releases/download/v1.1.4/JuliaConnectoR.pdf).

After you have installed Julia with `juliaup`, execute the command `julia` on the command line.
This will do the actual installation of Julia and start Julia for the first time.
On Linux and Windows, the `JuliaConnectoR` package should now be able to use the Julia installation, as the link to the Julia installation is on the `PATH`.
On Mac, Julia might not be on the `PATH` when using e.g. RStudio. In this case, ensure that Julia is on the `PATH` in R, or set the `JULIA_BINDIR` variable, as described below.

The specific Julia version can optionally be specified by using the `JULIA_BINDIR` variable. This will take precedence if specified.
When using `juliaup`, note that the `JULIA_BINDIR` variable must point to the actual installation directory of Julia. This is different from the directory that is returned when executing `which julia` on the command line, which is the directory that contains the link to the default Julia executable.

To get the proper value of the `JULIA_BINDIR` variable, execute `Sys.BINDIR` on the Julia command line. Then set the environment variable in R via `Sys.setenv("JULIA_BINDIR" = "/your/path/to/Julia/bin")` before starting Julia and the `JuliaConnectoR` should be able to discover the specified Julia installation.

## Overview

Expand All @@ -56,7 +50,7 @@ The following table lists the most important functions exported by the package:
| `juliaGet` | Fully translate a Julia object to an R object |
| `juliaExpr` | Use a Julia expressions or refer to a Julia object via a string in R |

For a detailed description of the functions with some examples, and for more details about the translation of data structures, please see the [latest documentation](https://github.com/stefan-m-lenz/JuliaConnectoR/releases/download/v1.1.3/JuliaConnectoR.pdf).
For a detailed description of the functions with some examples, and for more details about the translation of data structures, please see the [latest documentation](https://github.com/stefan-m-lenz/JuliaConnectoR/releases/download/v1.1.4/JuliaConnectoR.pdf).

## Examples

Expand Down
42 changes: 35 additions & 7 deletions man/Setup-JuliaConnectoR.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 184037f

Please sign in to comment.