Error when starting Rstudio "there is no package 'yaml'"

Hi, every time I start Rstudio (version 1.1.383) running R version 3.4.3, I get an error appearing twice:

"Error in loadNamespace(name) : there is no package called ‘yaml’"

This error appears in the lines ABOVE the first console chevron i.e. it's not caused by anything I have done, it shows up automatically when I start Rstudio. I did find the package called 'yaml' and install it but that didn't make any difference, didn't get rid of the error message.

The error is definitely an Rstudio error, because when I opened R standalone there was no error.

1 Like

This happened to me when I updated yaml and yaml dependencies while, unknowingly, having an R notebook open.

What worked for me was going to the document folder that stores the packages, which you can locate by doing

.libPaths()

and then simply deleting the yaml folder there. After that you should be able start a fresh RStudio session using Ctrl + Shift + F10 (or Cmd + Shift + F10 on mac) and simply reinstalling yaml.

install.packages("yaml") 
3 Likes

Thanks.
This approach worked for me.

1 Like

Hi,

I do not find yaml folder in the specified folder and I cant install it either.
Could you help me please?

The same happens to me: when I open RStudio I get 4 lines with the same message: Error in loadNamespace(name) : there is no package called ‘yaml’
I tried to knit an .Rmd and RStudio says that I need an updated version of the package yaml, and ask to me if I want to install it. I answered yes, the instalation starts but at the end Iget the following message:
The downloaded source packages are in
‘C:\Users\perezp\AppData\Local\Temp\RtmpaSD7LQ\downloaded_packages’
Error in loadNamespace(name) : there is no package called ‘yaml’
Error in loadNamespace(name) : there is no package called ‘yaml’
Error in loadNamespace(name) : there is no package called ‘yaml’
Error in loadNamespace(name) : there is no package called ‘yaml’

Any help? Thanks in advance

PS:
Session info -----------------------------------------
setting value
version R version 3.5.0 (2018-04-23)
system x86_64, mingw32
ui RStudio (1.1.419)
language (EN)
collate Spanish_Spain.1252

I have tried again to install the pkg "yaml", but this time from R, not from RStudio, and it has been installed.
At least for me, the problem is solved

If it persists after trying the earlier provided, just upgrade R.
I resolved it by removing/uninstalling R completely coz I could not manage to manually extract to the R folder every package I needed.

Good luck

For what it's worth, the issue with RStudio inadvertently loading the yaml package on startup should be resolved in the daily builds of RStudio:

https://dailies.rstudio.com

We hope to promote the v1.2 branch to a preview release in the near future, so we'd definitely appreciate it if you can take the time to give it a download and see if the issue is resolved.

A potentially easier solution than uninstalling and reinstalling R would be to go to your package library folder and delete the yaml folder. Then in R, rerun the install.packages("yaml") function.

I uninstalled R 3.4.4 and installed R 3.5 and my problem was solved.

I ended up losing a few hours of work today to this issue (trying to knit an Rmd file I created on OS X on a Windows 10 laptop, running R 3.5.0). At first, I was getting "yaml could not be parsed" errors, which I thought were due to some character encoding issues.

It was only after coming across this thread did I try restarting RStudio without loading an Rmd file -- and I still got yaml errors. Weird.

I updated to the latest daily release and the issue was resolved.

One oddity I have noticed is even after running install.packages("yaml", dep=T) and the package getting reinstalled, it does not appear in my packages list in RStudio. Is this normal?

As a follow-up, on the Windows laptop, I tried creating a new RMarkdown document, and RStudio could not find the package. I entered an infinite loop of downloading and not loading yaml.

I ended up checking my library directory and yaml was there... I moved it to where the base R packages live and now yaml shows up in my installed packages list in RStudio and loads properly when called.

Just adding my two cents:

For me, simply upgrading Rstudio to the latest version worked (I don't have R 3.5 yet). Of course, once you launch the newest Rstudio after install, simply execute (as usual):

install.packages("yaml")