I wanted to install the "unmarked" package in R but I couldn't. I got some warning messages which I have posted below.

devtools::install_github("rbchan/unmarked")
Downloading GitHub repo rbchan/unmarked@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All
2: CRAN packages only
3: None
4: processx (3.8.1 -> 3.8.2) [CRAN]

Enter one or more numbers, or an empty line to skip updates: geom_histogram(bins = 25,aes(fill = rain)) +
Enter one or more numbers, or an empty line to skip updates: 1
processx (3.8.1 -> 3.8.2) [CRAN]
Installing 1 packages: processx
Installing package into ‘C:/Users/Abi's/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/processx_3.8.2.zip'
Content type 'application/zip' length 686244 bytes (670 KB)
downloaded 670 KB

package ‘processx’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘processx’
Warning: restored ‘processx’

The downloaded binary packages are in
C:\Users\Abi's\AppData\Local\Temp\Rtmp0AGPXi\downloaded_packages
── R CMD build ─────────────────────────────────────────────────────────
:heavy_check_mark: checking for file 'C:\Users\Abi's\AppData\Local\Temp\Rtmp0AGPXi\remotes2dc87d527fb\rbchan-unmarked-ac40eed/DESCRIPTION' (3.1s)
─ preparing 'unmarked': (3.5s)
:heavy_check_mark: checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts (4.7s)
─ checking for empty or unneeded directories (449ms)
─ building 'unmarked_1.3.2.9002.tar.gz'

Installing package into ‘C:/Users/Abi's/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)

  • installing source package 'unmarked' ...
    ** using staged installation
    ** libs
    using C compiler: 'gcc.exe (GCC) 12.2.0'
    using C++ compiler: 'G__~1.EXE (GCC) 12.2.0'
    g++ -std=gnu++17 -I"C:/PROGRA~1/R/R-43~1.1/include" -DNDEBUG -DSTRICT_R_HEADERS -I'C:/Users/Abi's/AppData/Local/R/win-library/4.3/Rcpp/include' -I'C:/Users/Abi's/AppData/Local/R/win-library/4.3/RcppArmadillo/include' -I'C:/Users/Abi's/AppData/Local/R/win-library/4.3/TMB/include' -I'C:/Users/Abi's/AppData/Local/R/win-library/4.3/RcppEigen/include' -I"C:/RBuildTools/4.3/x86_64-w64-mingw32.static.posix/include" -fopenmp -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o
    RcppExports.cpp:4:10: fatal error: RcppArmadillo.h: No such file or directory
    4 | #include <RcppArmadillo.h>
    | ^~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [C:/PROGRA~1/R/R-43~1.1/etc/x64/Makeconf:272: RcppExports.o] Error 1
    ERROR: compilation failed for package 'unmarked'
  • removing 'C:/Users/Abi's/AppData/Local/R/win-library/4.3/unmarked'
    Warning messages:
    1: In file.copy(savedcopy, lib, recursive = TRUE) :
    problem copying C:\Users\Abi's\AppData\Local\R\win-library\4.3\00LOCK\processx\libs\x64\processx.dll to C:\Users\Abi's\AppData\Local\R\win-library\4.3\processx\libs\x64\processx.dll: Permission denied
    2: In i.p(...) :
    installation of package ‘C:/Users/Abi's/AppData/Local/Temp/Rtmp0AGPXi/file2dc87a0a591f/unmarked_1.3.2.9002.tar.gz’ had non-zero exit status

First, you cannot install the processx package (which is a dependency of the package you are installing) with devtools::install_github() because devtools loads the processx package, and if a package with compiled code is loaded in R, then it cannot be (esaily) updated.

I suggest you try to use the pak package instead, it has better behavior for this. (Or choose not to update the already installed processx version.. Or update processx from CRAN first.)

(Btw. this is a bit weird, because rbchan/unmarked does not seem to depend on processx...)

Second, seems like the RcppArmadillo dependency is not installed, or it is a broken installation, so try (re)installing that first.

E.g. with pak:

install.packages("pak")
pak::pkg_install("rbchan/unmarked")

or, if you need to (re)install RcppArmadillo:

pak::pkg_install(c("rbchan/unmarked", "RcppArmadillo?reinstall"))

it showed this

install.packages("pak")
Installing package into ‘C:/Users/Abi's/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/pak_0.6.0.zip'
Content type 'application/zip' length 12390264 bytes (11.8 MB)
downloaded 11.8 MB

package ‘pak’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Abi's\AppData\Local\Temp\RtmpoHn14K\downloaded_packages

pak::install("rbchan/unmarked")
Error: 'install' is not an exported object from 'namespace:pak'
pak::pkg_install(c("rbchan?unmarked",

  •                "RcppArmadillo?reinstall"))
    

! Unknown package parameter: "unmarked" in "rbchan?unmarked".
:heavy_check_mark: Updated metadata database: 5.10 MB in 15 files.
:heavy_check_mark: Updating metadata database ... done
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:

  • rbchan: Can't find package called rbchan.
  • RcppArmadillo: dependency conflict
    Type .Last.error to see the more details.

Hey Gabor, thanks a lot! It worked.

For the record, you have multiple typos in the commands that you ran, the errors are because of the typos.

This topic was automatically closed after 45 days. 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.