JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

On Windows, Julia progress bars are not shown in the console (unlike MacOS) #232

Open edwardlavender opened 3 months ago

edwardlavender commented 3 months ago

On MacOS, Julia progress bars print in the console, as shown by this reprex:

library(JuliaCall)
julia <- julia_setup()
julia_install_package_if_needed("ProgressMeter")

julia_code <- function(.x) {
  file <- tempfile(fileext = ".jl")
  on.exit(unlink(file), add = TRUE)
  writeLines(.x, file)
  # readLines(file)
  JuliaCall::julia_source(file)
}

julia_code(
  '
  using ProgressMeter: @showprogress
  @showprogress desc = "Computing..." for i in 1:10
    sleep(0.1)
  end
  '
)

which gives:

Computing... 100%|███████████████████████████████████████| Time: 0:00:01

On Windows, the same code runs but does not return the progress bar in the console.

I am using RStudio. Session Info on MacOS is:

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Rome
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] JuliaCall_0.17.5

loaded via a namespace (and not attached):
[1] compiler_4.3.1 tools_4.3.1    Rcpp_1.0.13    knitr_1.48    
[5] xfun_0.46

Session info on Windows is:

> sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 
[2] LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] JuliaCall_0.17.5

loaded via a namespace (and not attached):
[1] compiler_4.4.1 tools_4.4.1    Rcpp_1.0.13    knitr_1.48     xfun_0.46 

I have reproduced this issue on multiple Windows machines. I haven't checked behaviour on Linux.