# Help with Julia Integration in RStudio

**URL:** https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374
**Category:** General Usage
**Tags:** r, juliacall
**Created:** [January 2, 2025, 2:27pm UTC](https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374 "2025-01-02T14:27:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Gael\_Gautier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gael_gautier/32/214063_2.png) [@Gael\_Gautier](https://discourse.julialang.org/u/Gael_Gautier)
#### Post date: [January 2, 2025, 2:27pm UTC](https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374/1 "2025-01-02T14:27:40Z")

</div>

Hello,

I’m encountering an issue with using Julia in RStudio and would appreciate your help in resolving it.

I am using RStudio to write Quarto (qmd) scripts that include R, Python, and Bash code. However, due to the large size of my files, I would like to use Julia for certain operations to improve performance. I have installed Julia, and it works fine from the terminal, but it does not work in RStudio.

When I create a Julia chunk in RStudio, I receive the following message, no matter what I include in the chunk :

> Avis : l’exécution de la commande ‘’/home/gael/.julia/juliaup/julia-1.11.2+0.x64.linux.gnu/bin/julia’ ‘–startup-file=no’ ‘/home/gael/R/x86\_64-pc-linux-gnu-library/4.4/JuliaCall/julia/install\_dependency.jl’ ‘/usr/lib/R’ 2\>&1’ renvoie un statut 139LoadError(“/home/gael/R/x86\_64-pc-linux-gnu-library/4.4/JuliaCall/julia/setup.jl”, 16, ArgumentError(“Package RCall not found in current path.\n- Run import Pkg; Pkg.add("RCall") to install the RCall package.”)) Erreur dans .julia$cmd(paste0(Rhomeset, “Base.include(Main,"”, system.file(“julia/setup.jl”, :  
> Error happens when you try to execute command ENV[“R\_HOME”] = “/usr/lib/R”;Base.include(Main,“/home/gael/R/x86\_64-pc-linux-gnu-library/4.4/JuliaCall/julia/setup.jl”) in Julia.  
> To have more helpful error messages,  
> you could considering running the command in Julia directly

To resolve this, I installed the `RCall` package from Julia directly, which worked. However, when I return to RStudio (which I restarted before running any further tests) and try running a Julia chunk again, I get the following error regardless of what I put inside the chunk :

> R session aborted. R encountered a fatal error. The session was terminated"

I am working on a Linux machine with **Ubuntu 24.04.1 LTS** , using **Julia version 1.11.2** , **R version 4.4.2** , and **RStudio version 2024.12.0 Build 467**.  
I use the package **RCall v0.14.6** and in R the package **JuliaCall 0.17.6**

If I try to launch Julia code frome R chunck with JuliaCall it fails also in the same way than describe uppon.

Could you please help me solve this issue? It would be very helpful. Thank you in advance!

---

<div class="post-metadata">

### Author: ![simonsteiger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonsteiger/32/209862_2.png) [@simonsteiger](https://discourse.julialang.org/u/simonsteiger)
#### Post date: [January 2, 2025, 3:41pm UTC](https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374/2 "2025-01-02T15:41:04Z")

</div>

Hi and welcome! 🙂

I’ve tried reproducing this and also get an error if I work inside RStudio. Curiously, the error appeared when trying to render the `.qmd` in RStudio’s terminal with `quarto render notebook.qmd`, but not when running the same from the terminal outside RStudio.

I started by creating a new project from the Julia REPL:

```julia-repl
julia> import Pkg
julia> Pkg.activate("quarto-test")
julia> Pkg.add("RCall")

```

I then created a (very simple) `.qmd` file with R and Julia code blocks:

````qmd
---
engine: julia
---

```{julia}
using RCall
```

```{r}
1 + 1
```

```{julia}
1 + 1
```

````

If I render this file from RStudio while no julia process is running, I run into an error suggesting that the julia process could not be started.

```julia
ERROR: NotFound: Failed to spawn 'julia': No such file or directory (os error 2)

Stack trace:
    at spawnChildInner (ext:runtime/40_process.js:186:17)
    at spawnChild (ext:runtime/40_process.js:208:10)
    at Command.spawn (ext:runtime/40_process.js:480:12)
    at ensureQuartoNotebookRunnerEnvironment (file:///Applications/quarto/bin/quarto.js:41209:26)
    at startOrReuseJuliaServer (file:///Applications/quarto/bin/quarto.js:41120:19)
    at getJuliaServerConnection (file:///Applications/quarto/bin/quarto.js:41233:30)
    at getJuliaServerConnection (file:///Applications/quarto/bin/quarto.js:41263:26)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async executeJulia (file:///Applications/quarto/bin/quarto.js:41292:18)
    at async Object.execute (file:///Applications/quarto/bin/quarto.js:41037:20)

```

However, if I first render the same file from the terminal (or VSCode), the julia process starts normally, and for as long as it is active, I can also render the document from within RStudio.

What happens if you try to render your notebook from the terminal with `quarto render notebook.qmd`?

---

<div class="post-metadata">

### Author: ![Gael\_Gautier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gael_gautier/32/214063_2.png) [@Gael\_Gautier](https://discourse.julialang.org/u/Gael_Gautier)
#### Post date: [January 3, 2025, 9:39am UTC](https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374/3 "2025-01-03T09:39:50Z")

</div>

Hello I just did what you suggested and I have the same results. From the terminal inside Rstudio I have the same error but if I try from a classic terminal it works. I suppose that means the problem is come from Rstudio.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [January 3, 2025, 10:04am UTC](https://discourse.julialang.org/t/help-with-julia-integration-in-rstudio/124374/4 "2025-01-03T10:04:56Z")

</div>

`quarto` just uses `julia` by default to start the server process, it seems that RStudio does something to the PATH so that it’s not found, at least that would be my only explanation why it does work from terminal or VSCode. You can set a different julia with the env variable `QUARTO_JULIA=/path/to/julia` but this has to be done before the server process is running.
