# Loading R packages not working anymore after updating R

**URL:** <https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592>\
**Category:** General Usage\
**Tags:** vscode, r, rcall\
**Created:** [April 28, 2024, 5:07pm UTC](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592 "2024-04-28T17:07:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugo](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@Hugo](https://discourse.julialang.org/u/Hugo)\
**Post date:** [April 28, 2024, 5:07pm UTC](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592/1 "2024-04-28T17:07:23Z")

</div>

For a while, I had been calling `R` functionalities from my `Julia` code successfully with package `RCall`. Recently, however, I updated the version of my `R` installation, and now it seems the `Julia` code is broken. I should say that I’m using `VSCode` to run the `.jl` file, and the attached `R`’s version is the same as my latest installation of `R`.

When I run the following lines:

```julia
using RCall
R"""
    library(forecast)
"""

```

I get the following error message:

> ERROR: REvalError: Warning: package ‘forecast’ was built under R version 4.3.3  
> Error: package or namespace load failed for ‘forecast’ in inDL(x, as.logical(local), as.logical(now), …):  
> unable to load shared object ‘C:/Users/----/Documents/R/win-library/4.1/rlang/libs/x64/rlang.dll’:  
> LoadLibrary failure: The specified procedure could not be found.

The thing is, I have installed package `forecast` under `R` version 4.3.3. If I call the package from the `R` GUI, it works fine. I _guess_ it might a problem with VSCode not “finding” whatever it has to find to make it work. I should add that I have added the path to `R`’s exe file to the ‘User Settings’ in VSCode’s JSON file.

Anyone know how to solve this? Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [April 28, 2024, 5:31pm UTC](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592/2 "2024-04-28T17:31:11Z")

</div>

I find this:

[https://www.reddit.com/r/RStudio/comments/1azh8xf/if\_i\_update\_r\_does\_it\_replace\_the\_old\_r\_version/](https://www.reddit.com/r/RStudio/comments/1azh8xf/if_i_update_r_does_it_replace_the_old_r_version/)

> An upgrade to 4.4 will make a new install of R which RStudio will use by default and you’ll need to reinstall all your packages.

It seems like an R problem, on that side, and would be independently of if not use from Julia or other language. I’m no R expert, I guess 4.4 may be consider a major upgrade (and/or requiring recompilation of R packages, because of breaking API? Maybe that’s it, why reinstall needed, since might as well if potentially incompatible), not just if first digit changes, and I’m not sure when that last happened. Might be rare.

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [April 28, 2024, 9:54pm UTC](https://discourse.julialang.org/t/loading-r-packages-not-working-anymore-after-updating-r/113592/3 "2024-04-28T21:54:11Z")

</div>

> [@Hugo](#):
>
> C:/Users/----/Documents/R/win-library/4.1/rlang/libs/x64/rlang.dll

Consider also the path - C:/Users/----/Documents/R/win-library/ **4.1** /rlang/libs/x64/rlang.dll implies Julia is loading R 4.1, not R 4.3, which may be the issue. Take a look at [Installation · RCall.jl](https://juliainterop.github.io/RCall.jl/stable/installation/#Customizing-the-R-installation-using-Julia's-Preferences-system) and see if setting the preference to your known good R path helps!
