'Trying to install R packages from GitHub with devtools

I am trying to install from Github.

devtools::install_github("DataScienceProjectsJapan/R4DSTutorial2")

R keeps asking me to install/reinstall more and more packages. Does anyone know what is going on? If I continue it gives errors at the end. R also asks questions like: "Do you want to install from sources the packages which need compilation?" I am not sure if I should say yes or no.

Here is the final error messages

Error : 'tidyverse' is a meta-package and it is rarely a good idea to depend on it. Please determine the specific underlying package(s) that offer the function(s) you need and depend on that instead. For data analysis projects that use a package structure but do not implement a formal R package, adding 'tidyverse' to Depends is a reasonable compromise. Call `use_package("tidyverse", type = "depends")` to achieve this.
Error: unable to load R code in package 'R4DSTutorial2nd'
Execution halted
ERROR: lazy loading failed for package 'R4DSTutorial2nd'
* removing 'C:/Users/willi/Documents/R/win-library/4.1/R4DSTutorial2nd'
* restoring previous 'C:/Users/willi/Documents/R/win-library/4.1/R4DSTutorial2nd'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\willi\Documents\R\win-library\4.1\00LOCK\cli\libs\x64\cli.dll to C:\Users\willi\Documents\R\win-library\4.1\cli\libs\x64\cli.dll: Permission denied
2: In i.p(...) : installation of package ‘glue’ had non-zero exit status
3: In i.p(...) : installation of package ‘rlang’ had non-zero exit status
4: In i.p(...) :
  installation of package ‘magrittr’ had non-zero exit status
5: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\willi\Documents\R\win-library\4.1\00LOCK\cli\libs\x64\cli.dll to C:\Users\willi\Documents\R\win-library\4.1\cli\libs\x64\cli.dll: Permission denied
6: In i.p(...) : installation of package ‘rlang’ had non-zero exit status
7: In i.p(...) : installation of package ‘glue’ had non-zero exit status
8: In i.p(...) :
  installation of package ‘magrittr’ had non-zero exit status
9: In i.p(...) :
  installation of package ‘C:/Users/willi/AppData/Local/Temp/Rtmpo1LQjG/file2e3829c364ed/R4DSTutorial2nd_0.0.0.9000.tar.gz’ had non-zero exit status
> 

Here is the beginning of the response to

devtools::install_github("DataScienceProjectsJapan/R4DSTutorial2")
Downloading GitHub repo DataScienceProjectsJapan/R4DSTutorial2@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: nycflights13 (1.0.2  -> 1273c4e8f...) [GitHub]
5: cli          (3.0.1  -> 3.1.1       ) [CRAN]  
6: glue         (1.6.0  -> 1.6.1       ) [CRAN]  
7: rlang        (0.4.12 -> 1.0.0       ) [CRAN]  
8: magrittr     (2.0.1  -> 2.0.2       ) [CRAN]  

Enter one or more numbers, or an empty line to skip updates: 1
nycflights13 (1.0.2  -> 1273c4e8f...) [GitHub]
cli          (3.0.1  -> 3.1.1       ) [CRAN]
glue         (1.6.0  -> 1.6.1       ) [CRAN]
rlang        (0.4.12 -> 1.0.0       ) [CRAN]
magrittr     (2.0.1  -> 2.0.2       ) [CRAN]
Installing 4 packages: cli, glue, rlang, magrittr
Installing packages into ‘C:/Users/willi/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)

  There are binary versions available but the source
  versions are later:
         binary source needs_compilation
glue      1.6.0  1.6.1              TRUE
rlang    0.4.12  1.0.0              TRUE
magrittr  2.0.1  2.0.2              TRUE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.1.1.zip'
Content type 'application/zip' length 1236853 bytes (1.2 MB)
downloaded 1.2 MB

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

The downloaded binary packages are in
    C:\Users\willi\AppData\Local\Temp\Rtmpo1LQjG\downloaded_packages
installing the source packages ‘glue’, ‘rlang’, ‘magrittr’

trying URL 'https://cran.rstudio.com/src/contrib/glue_1.6.1.tar.gz'
Content type 'application/x-gzip' length 110723 bytes (108 KB)
downloaded 108 KB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_1.0.0.tar.gz'
Content type 'application/x-gzip' length 707509 bytes (690 KB)
downloaded 690 KB

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

-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5     v purrr   0.3.4
v tibble  3.1.6     v dplyr   1.0.7
v tidyr   1.1.3     v stringr 1.4.0
v readr   2.0.1     v forcats 0.5.1

Warning messages:
1: package 'tidyverse' was built under R version 4.1.2 
2: package 'tibble' was built under R version 4.1.2 

Attaching package: 'lubridate'

The following objects are masked from 'package:base':

    date, intersect, setdiff, union

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Highcharts (www.highcharts.com) is a Highsoft software product which is
not free for commercial and Governmental use
Loading required package: PerformanceAnalytics
Loading required package: xts
Loading required package: zoo
Loading required package: stats

Attaching package: 'stats'

The following objects are masked from 'package:dplyr':

    filter, lag


Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Attaching package: 'xts'

The following objects are masked from 'package:dplyr':

    first, last

Loading required package: quantmod
Loading required package: TTR
== Need to Learn tidyquant? ====================================================
Business Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!
</> Learn more at: https://university.business-science.io/p/learning-labs-pro </>

Attaching package: 'tibbletime'

The following object is masked from 'package:stats':

    filter


Attaching package: 'scales'

The following object is masked from 'package:purrr':

    discard

The following object is masked from 'package:readr':

    col_factor

* installing *source* package 'glue' ...
** package 'glue' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/willi/Documents/R/win-library/4.1/glue'
* restoring previous 'C:/Users/willi/Documents/R/win-library/4.1/glue'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\willi\Documents\R\win-library\4.1\00LOCK-glue\glue\libs\x64\glue.dll to C:\Users\willi\Documents\R\win-library\4.1\glue\libs\x64\glue.dll: Permission denied
-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5     v purrr   0.3.4
v tibble  3.1.6     v dplyr   1.0.7
v tidyr   1.1.3     v stringr 1.4.0
v readr   2.0.1     v forcats 0.5.1

Warning messages:
1: package 'tidyverse' was built under R version 4.1.2 
2: package 'tibble' was built under R version 4.1.2 

Attaching package: 'lubridate'

The following objects are masked from 'package:base':

    date, intersect, setdiff, union

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Loading required package: PerformanceAnalytics
Loading required package: xts
Loading required package: zoo
Loading required package: stats

Attaching package: 'stats'

The following objects are masked from 'package:dplyr':

    filter, lag


Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Attaching package: 'xts'

The following objects are masked from 'package:dplyr':

    first, last

Loading required package: quantmod
Loading required package: TTR
== Need to Learn tidyquant? ====================================================
Business Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!
</> Learn more at: https://university.business-science.io/p/learning-labs-pro </>

Attaching package: 'tibbletime'

The following object is masked from 'package:stats':

    filter


Attaching package: 'scales'

The following object is masked from 'package:purrr':

    discard

The following object is masked from 'package:readr':

    col_factor

* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/willi/Documents/R/win-library/4.1/rlang'
* restoring previous 'C:/Users/willi/Documents/R/win-library/4.1/rlang'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\willi\Documents\R\win-library\4.1\00LOCK-rlang\rlang\libs\x64\rlang.dll to C:\Users\willi\Documents\R\win-library\4.1\rlang\libs\x64\rlang.dll: Permission denied
-- Attaching packages --------------------------------------- tidyverse 1.3.1 --
v ggplot2 3.3.5     v purrr   0.3.4
v tibble  3.1.6     v dplyr   1.0.7
v tidyr   1.1.3     v stringr 1.4.0
v readr   2.0.1     v forcats 0.5.1

Warning messages:
1: package 'tidyverse' was built under R version 4.1.2 
2: package 'tibble' was built under R version 4.1.2 

Attaching package: 'lubridate'

The following objects are masked from 'package:base':

    date, intersect, setdiff, union

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 
Loading required package: PerformanceAnalytics
Loading required package: xts
Loading required package: zoo
Loading required package: stats

Attaching package: 'stats'

The following objects are masked from 'package:dplyr':

    filter, lag


Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


Attaching package: 'xts'

The following objects are masked from 'package:dplyr':

    first, last

Loading required package: quantmod
Loading required package: TTR
== Need to Learn tidyquant? ====================================================
Business Science offers a 1-hour course - Learning Lab #9: Performance Analysis & Portfolio Optimization with tidyquant!
</> Learn more at: https://university.business-science.io/p/learning-labs-pro </>

Attaching package: 'tibbletime'

The following object is masked from 'package:stats':

    filter


Attaching package: 'scales'

The following object is masked from 'package:purrr':

    discard

The following object is masked from 'package:readr':

    col_factor

* installing *source* package 'magrittr' ...
** package 'magrittr' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/willi/Documents/R/win-library/4.1/magrittr'
* restoring previous 'C:/Users/willi/Documents/R/win-library/4.1/magrittr'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\willi\Documents\R\win-library\4.1\00LOCK-magrittr\magrittr\libs\x64\magrittr.dll to C:\Users\willi\Documents\R\win-library\4.1\magrittr\libs\x64\magrittr.dll: Permission denied

The downloaded source packages are in
    ‘C:\Users\willi\AppData\Local\Temp\Rtmpo1LQjG\downloaded_packages’
Downloading GitHub repo hadley/nycflights13@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: rlang    (0.4.12 -> 1.0.0) [CRAN]
5: glue     (1.6.0  -> 1.6.1) [CRAN]
6: cli      (3.0.1  -> 3.1.1) [CRAN]
7: magrittr (2.0.1  -> 2.0.2) [CRAN]

Enter one or more numbers, or an empty line to skip updates


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source