Problems installing Tidycensus package: non-zero exit status and dependency not available

Hello,

I am trying to install the tidycensus package. I get an error. When I run:

install.packages("tidycensus") 
install.packages("tidycensus", dependencies = TRUE)

The output:

Installing package into ‘C:/USER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependency ‘tigris’


  There are binary versions available but the source versions
  are later:
           binary source needs_compilation
tigris        1.0    1.5             FALSE
tidycensus 0.11.4    1.1             FALSE

installing the source packages ‘tigris’, ‘tidycensus’

trying URL 'https://cran.rstudio.com/src/contrib/tigris_1.5.tar.gz'
Content type 'application/x-gzip' length 266668 bytes (260 KB)
downloaded 260 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidycensus_1.1.tar.gz'
Content type 'application/x-gzip' length 2117301 bytes (2.0 MB)
downloaded 2.0 MB

* installing *source* package 'tigris' ...
** package 'tigris' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in normalizePath(path.expand(path), winslash, mustWork) : 
  path[1]="C:/USER/Documents/R/win-library/3.6/sp/libs/x64": The tag present in the reparse point buffer is invalid
Calls: <Anonymous> ... loadNamespace -> library.dynam -> file.path -> normalizePath
Execution halted
ERROR: lazy loading failed for package 'tigris'
* removing 'C:/USER/Documents/R/win-library/3.6/tigris'
Warning in install.packages :
  installation of package ‘tigris’ had non-zero exit status
ERROR: dependency 'tigris' is not available for package 'tidycensus'
* removing 'C:/USER/Documents/R/win-library/3.6/tidycensus'
Warning in install.packages :
  installation of package ‘tidycensus’ had non-zero exit status

The downloaded source packages are in
	‘C:\USER\AppData\Local\Temp\downloaded_packages’

Any help would be appreciated. Thank you!

What happens if you try and install tigris by itself, then restart RStudio?

Thank you for your reply.

When I run install.packages("tigris", dependencies = TRUE), the following error shows up:

Error in normalizePath(path.expand(path), winslash, mustWork) : 
  path[1]="C:/USER/Documents/R/win-library/3.6/sp/libs/x64": The tag present in the reparse point buffer is invalid
Calls: <Anonymous> ... loadNamespace -> library.dynam -> file.path -> normalizePath
Execution halted
ERROR: lazy loading failed for package 'tigris'
* removing 'C:/USER/Documents/R/win-library/3.6/tigris'
Warning in install.packages :
  installation of package ‘tigris’ had non-zero exit status
ERROR: dependency 'tigris' is not available for package 'tidycensus'
* removing 'C:/USER/Documents/R/win-library/3.6/tidycensus'
Warning in install.packages :
  installation of package ‘tidycensus’ had non-zero exit status

The downloaded source packages are in
	‘C:\USER\AppData\Local\Temp\downloaded_packages’ 

When I try to load it:

> library(tigris)
Error in library(tigris) : there is no package called ‘tigris’

The problem seems to come from here, try reinstalling the sp package, do you get any error messages?

Unfortunately, I get pretty much the same error. This is the output when I try to install the sp package:

> install.packages("sp", dependencies = TRUE)

Installing package into ‘C:/USER/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘xts’, ‘intervals’, ‘zoo’, ‘spacetime’, ‘FNN’, ‘gstat’, ‘deldir’


  There are binary versions available but the source versions are later:
          binary source needs_compilation
spacetime  1.2-4  1.2-5             FALSE
gstat      2.0-7  2.0-8              TRUE
deldir    0.2-10  1.0-2              TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/xts_0.12.1.zip'
Content type 'application/zip' length 947871 bytes (925 KB)
downloaded 925 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/intervals_0.15.2.zip'
Content type 'application/zip' length 1000548 bytes (977 KB)
downloaded 977 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/zoo_1.8-9.zip'
Content type 'application/zip' length 1038955 bytes (1014 KB)
downloaded 1014 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/FNN_1.1.3.zip'
Content type 'application/zip' length 637905 bytes (622 KB)
downloaded 622 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/gstat_2.0-7.zip'
Content type 'application/zip' length 2492331 bytes (2.4 MB)
downloaded 2.4 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/deldir_0.2-10.zip'
Content type 'application/zip' length 338863 bytes (330 KB)
downloaded 330 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/sp_1.4-5.zip'
Content type 'application/zip' length 1810715 bytes (1.7 MB)
downloaded 1.7 MB

package ‘xts’ successfully unpacked and MD5 sums checked
package ‘intervals’ successfully unpacked and MD5 sums checked
package ‘zoo’ successfully unpacked and MD5 sums checked
package ‘FNN’ successfully unpacked and MD5 sums checked
package ‘gstat’ successfully unpacked and MD5 sums checked
package ‘deldir’ successfully unpacked and MD5 sums checked
package ‘sp’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot delete reparse point 'C:\USER\Documents\R\win-library\3.6/sp/libs', reason 'There is a mismatch between the tag specified in the request and the tag present in the reparse point'
Warning in install.packages :
  cannot remove prior installation of package ‘sp’
Warning in install.packages :
  cannot delete reparse point 'C:\USER\Documents\R\win-library\3.6/sp/libs', reason 'There is a mismatch between the tag specified in the request and the tag present in the reparse point'
Warning in install.packages :
  restored ‘sp’

The downloaded binary packages are in
	C:\USER\AppData\Local\Temp\downloaded_packages
installing the source package ‘spacetime’

trying URL 'https://cran.rstudio.com/src/contrib/spacetime_1.2-5.tar.gz'
Content type 'application/x-gzip' length 2571457 bytes (2.5 MB)
downloaded 2.5 MB

* installing *source* package 'spacetime' ...
** package 'spacetime' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
Error in normalizePath(path.expand(path), winslash, mustWork) : 
  path[1]="C:/USER/Documents/R/win-library/3.6/sp/libs/x64": The tag present in the reparse point buffer is invalid
Calls: <Anonymous> ... loadNamespace -> library.dynam -> file.path -> normalizePath
Execution halted
ERROR: lazy loading failed for package 'spacetime'
* removing 'C:/USER/Documents/R/win-library/3.6/spacetime'
Warning in install.packages :
  installation of package ‘spacetime’ had non-zero exit status

The downloaded source packages are in
	‘C:\USER\AppData\Local\Temp\downloaded_packages’

Try manually deleting the folder C:\USER\Documents\R\win-library\3.6/sp and then install sp again.

For some reason, when I highlight the folder, and click the "delete" button, nothing happens. The folder remains.

Just to clarify, Have you opened the Windows file explorer and you can't delete the folder? if that is the case then your problem is with your Windows configuration and not with R or RStudio.

Yes, that is the case. I opened my file explorer.