installing the 'unmarked' package

facing issues to install unmarked install.packages("unmarked")
Warning in install.packages :
cannot open compressed file 'C:\Users\LENOVO\AppData\Local\Temp\Rtmpwpczt1/libloc_181_5126c10d.rds', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
install.packages("pak")
Warning in install.packages :
cannot open compressed file 'C:\Users\LENOVO\AppData\Local\Temp\Rtmpwpczt1/libloc_181_5126c10d.rds', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

pak::pkg_install("rbchan/unmarked")
Error in loadNamespace(x) : there is no package called ‘pak’

Welcome to the Forum.

Can you show us exactly the code that you are using?

Copy the code and paste it between
```

```

Have you had any problem installing other packages?

Thanks Below is the code...now it worked partly

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

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

install.packages(unmarked)

 below is the response  after the code was run                                                                                                                                                                               ℹ Packaging unmarked 1.4.1.9005                                         

:check_mark: Packaged unmarked 1.4.1.9005 (16.8s)
:information_source: Building unmarked 1.4.1.9005
Error:
! error in pak subprocess
Caused by error:
! Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.
:information_source: See $stderr for standard error.
Type .Last.error to see the more details.

library(unmarked)
Error in library(unmarked) : there is no package called ‘unmarked’
install.packages(unmarked)
Error in install.packages : object 'unmarked' not found

I am not a Windows user but a handy AI suggests this:

You must install Rtools, which contains the required compiler toolchain.Go to the CRAN Rtools Page.Download the installer version that exactly matches your primary R version (e.g., Rtools44 for R 4.4).Run the downloaded .exe file and install it into the default recommended path (e.g., C:\rtools44).Completely restart RStudio.

I think you are missing a FORTRAN or C++ compiler. Rtools should deal with the problem.

Not quite sure what went wrong with your very first attempt, but with pak::pkg_install("rbchan/unmarked") you'd build the latest Github version, which seems to lag behind the current CRAN binary release, 1.5.1. Is this what you are after?
Now that you have installed pak, just try with

pak::pkg_install("unmarked")

to install the binary from CRAN.

[quote="riyaz, post:3, topic:216867"]
! Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.

Thanks but I tried the other one which worked

Many thanks....this one worked