Cannot download packages in R studio

First time posting, hoping not to mess it up. I cannot seem to download packages in Rstudio on Windows. I have tried several packages (R markdown, xfun, htmlTable, sjPlot, Knitr, etc.) and get the same error each time:
installing source package 'htmlTable' ...
** package 'htmlTable' successfully unpacked and MD5 sums checked
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'xfun' 0.13 is being loaded, but >= 0.15 is required
ERROR: lazy loading failed for package 'htmlTable'

  • removing 'C:/Users/seaso_000/Documents/R/win-library/3.5/htmlTable'
    In R CMD INSTALL
    Warning in install.packages :
    installation of package ‘htmlTable’ had non-zero exit status

I have seen advice on this forum and have tried the following: downloading developer version from CRAN, updating packages, updating Xfun, updating R markdown, etc. Most of the advice seems to be for MAC OS, but tried anyway but did not work. I also tried installing with dependencies = TRUE which also did not work. This is happening for almost every program I tried to download.

I don't know how to produce a reproducible example as it is all package loading. Any advice would be appreciated. I recently downloaded Ubuntu to my computer (would this interfere?). I also know that knitr dependencies (required for markdown and other packages) were removed from CRAN, could this cause the issue?

I'm at a total loss. Thank you for any help you can provide.

There is a conflict in installation because a version is already loaded. This is very often the case on WINDOWS too where there are some DLL being lock.

I would advice to closes all opened R and RStudio and then install.packages("xfun") from a new R session with nothing loaded (if possible opened with R GUI and not RStudio).

Then try installing htmlTable.

Hope it helps

Thank you, I tried that but it did not work. I get the same error when following these instructions. I am considering uninstalling/re-installing R and R studio as so many packages are impacted.

Are you install htmlTable from github ?
On Windows, it should install the binary. It is why I asked.

I tried with install.packages("htmlTable") on Windows and not issue.

if you still have the same issue

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'xfun' 0.13 is being loaded, but >= 0.15 is required

It means may still have on session opened with old xfun loaded. When you tried you had all sessions closed before and used R Gui (not RStudio) to install ? and only install xfun with

install.packages("xfun")

Once you get the last xfun (0.19), you should be able to install htmlTable

Also there is a very new package which tries to solve this kind of issue, especially on Windows. https://github.com/r-lib/pak/ . If you want to try it, it may solve it.

install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
pak::pkg_install("xfun")

Unfortunately, it did not work. I uninstalled R and R studio and re-installed. That fixed the issue.

Thank you.

1 Like

Glad it worked. I am not sure to see the direct link with the issue but it would have surely unload everything for sure to start fresh !

I marked your topic as answered to close the feed and show others what worked for you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.