Problem loading knitcitations package in R 3.6.3

I'm having trouble loading my knitcitations package for R markdown. It keeps giving me the following error message:

> library(knitcitations)
Error: package or namespace load failed for ‘knitcitations’ in loadNamespace(i, 
c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called 
‘stringi’

I've tried to uninstall and reinstall knitcitations as well as use installl.packages("stringi", repos="http://cran.rstudio.com/", dependencies=TRUE), however neither of those seem to be working. Any help would be greatly appreciated.

Can you post the complete output message you get when you run this command?

1 Like

Yes, here it what it gives me:

> install.packages("stringi", repos="http://cran.rstudio.com/", dependencies=TRUE)
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Owner/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
        binary source needs_compilation
stringi  1.4.6  1.5.3              TRUE

installing the source package ‘stringi’

trying URL 'http://cran.rstudio.com/src/contrib/stringi_1.5.3.tar.gz'
Content type 'application/x-gzip' length 7293930 bytes (7.0 MB)
downloaded 7.0 MB

ERROR: failed to lock directory 'C:/Users/Owner/Documents/R/win-library/3.6' for modifying
Try removing 'C:/Users/Owner/Documents/R/win-library/3.6/00LOCK-stringi'
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Owner\AppData\Local\Temp\RtmpOoyjmi\downloaded_packages’

It also mentions in the beginning warning that I don't have Rtools installed, which I made sure I did have.

What version of Rtools have you installed? It has to be compatible with your R version.

To solve this part, you just have to follow the instructions and delete that file.

The Rtools that I have installed is rtools40-x86_64 (this was on the installer I downloaded).

And then I found and deleted the indicated file described in the instructions you pointed out.

RTools40 is for R >= 4.0.0 since you are using R 3.6.3 you have to use Rtools35, you can download it from here

https://cran.r-project.org/bin/windows/Rtools/history.html

Or, you could update your R version

That worked!! Thank you so much! I was able to download the stringi package and load both that and knitcitations correctly. My document is also knitting properly now.

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

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.