Skip to content
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

Create install_julia.sh #157

Closed
wants to merge 1 commit into from

Conversation

grantmcdermott
Copy link
Contributor

Would fix #128

I expect you'll want to change certain things about the script, but I just tested locally and it seems to work fine for me. Happy to continue the discussion here.

Comment on lines +21 to +22
echo 'export PATH="/opt/julia/bin:$PATH"' >> .bashrc
source .bashrc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking other scripts, I think there is room for modification in the way the PATH is set.

# pipenv requires ~/.local/bin to be on the path...
echo "PATH=/opt/pyenv/bin:~/.local/bin:$PATH" >> ${R_HOME}/etc/Renviron
echo "PATH=/opt/pyenv/bin:~/.local/bin:$PATH" >> /etc/bash.bashrc

How to set environment variables is currently being discussed in #151 (comment), but the above description seems to be the standard at this time.

I am not an expert in these scripts or PATH settings, so if this comment is incorrect, please feel free to ignore it.

@eitsupi
Copy link
Member

eitsupi commented May 12, 2021

I think we may extract the latest stable version of Julia from the json file which Julia versions' information is recorded.

If we are allowed to use the jsonlite and the purrr packages and pipe operator in R, we can get 1.6.1 like this.

library(jsonlite)
library(purrr)
library(dplyr)

js <- jsonlite::read_json("https://julialang-s3.julialang.org/bin/versions.json")

versions <- names(js)

is_stable <- purrr::map(js, ~ .x$stable == TRUE) %>%
  purrr::as_vector()

versions[is_stable] %>%
  sort(decreasing = T) %>%
  {.[1]}

I don't know how to do the same thing without installing any packages or tools...

@eitsupi
Copy link
Member

eitsupi commented Jun 21, 2021

When we install JuliaCall, the yaml package is also installed, and we can use yaml::read_yaml to read json file, so it looks like we can get the latest Julia version without any additional packages.

js <- yaml::read_yaml("https://julialang-s3.julialang.org/bin/versions.json")

versions <- js |>
  names()

is_stable <- Map(function(x) x$stable, js) |>
  unlist()

versions[is_stable] |>
  sort(decreasing = TRUE) |>
  (function(x) x[1])()

in bash

$ Rscript -e "
js <- yaml::read_yaml('https://julialang-s3.julialang.org/bin/versions.json')

versions <- js |> \
  names()

is_stable <- Map(function(x) x\$stable, js) |> \
  unlist()

versions[is_stable] |> \
  sort(decreasing = TRUE) |> \
  (function(x) x[1])() |> \
  cat()" | cat
1.6.1

@eitsupi eitsupi mentioned this pull request Oct 20, 2021
1 task
@grantmcdermott
Copy link
Contributor Author

Close in favour of #269.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

install_julia script
2 participants