r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 755 forks source link

duplicate row.names #2514

Closed pachadotdev closed 1 year ago

pachadotdev commented 1 year ago

With devtools (devtools * 2.4.3 2021-11-30 [3] CRAN (R 4.2.0)) we see this when there is more than one package to install when, for example, we want to install the r4ds package from github.com/cienciadedatos/r4ds

> install()
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: vctrs       (0.6.1  -> 0.6.2 ) [CRAN]
 5: stringr     (1.4.1  -> 1.5.0 ) [CRAN]
 6: rlang       (1.1.0  -> 1.1.1 ) [CRAN]
 7: dplyr       (1.1.1  -> 1.1.2 ) [CRAN]
 8: viridisLite (0.4.1  -> 0.4.2 ) [CRAN]
 9: isoband     (0.2.6  -> 0.2.7 ) [CRAN]
10: xml2        (1.3.3  -> 1.3.4 ) [CRAN]
11: httr        (1.4.5  -> 1.4.6 ) [CRAN]
12: digest      (0.6.30 -> 0.6.31) [CRAN]
13: cachem      (1.0.7  -> 1.0.8 ) [CRAN]
14: sass        (0.4.5  -> 0.4.6 ) [CRAN]
15: tinytex     (0.44   -> 0.45  ) [CRAN]
16: fontawesome (0.5.0  -> 0.5.1 ) [CRAN]
17: bslib       (0.4.1  -> 0.4.2 ) [CRAN]
18: xfun        (0.38   -> 0.39  ) [CRAN]
19: highr       (0.9    -> 0.10  ) [CRAN]
20: evaluate    (0.20   -> 0.21  ) [CRAN]
21: fs          (1.6.1  -> 1.6.2 ) [CRAN]
22: ragg        (1.2.1  -> 1.2.5 ) [CRAN]
23: markdown    (1.6    -> 1.7   ) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
Installing 21 packages: gridExtra, terra, modeldata, palmerpenguins, nycflights13, nasaweather, Lahman, gapminder, fueleconomy, babynames, lobstr, leaflet.providers, viridis, raster, png, datos, pryr, microbenchmark, maps, leaflet, hexbin
Available system packages...

  There are binary versions available but the source versions are later:
Error in data.frame(binary = binvers, source = srcvers, row.names = bins,  : 
  duplicate row.names: gridExtra, terra, modeldata, palmerpenguins, nycflights13, Lahman, lobstr, leaflet.providers, viridis, raster, png

if we install N-1 or N missing dependencies, devtools::install() works

jennybc commented 1 year ago

The current release of devtools is 2.4.5, so the first thing to do is to update devtools and check if you can reproduce the problem.

I don't quite follow the above, as it appears you select "3" corresponding to "None". And then I see "Installling 21 packages..." Is that the problem?

pachadotdev commented 1 year ago

thanks, I am trying to render the book in a 100% new environment, so it installs 21 packages but then fails, unless I install gridExtra, terra, modeldata, palmerpenguins, etc one by one

btw, Ubuntu has devtools 2.4.3, otherwise I need to compile from sources

jennybc commented 1 year ago

Even if there is a bug in devtools 2.4.3, I can't fix it, because I can't go back in time. So the only finding that I could potentially act on is if this can be reproduced with the current version of devtools.

I also suspect that if we establish a problem, it's going to be in the remotes package not devtools, because that's where this menu is actually coming from:

https://github.com/r-lib/remotes/blob/1e12140952d239ccbfc58df1a116ae3a50792d7e/R/deps.R#L660

cc @gaborcsardi

gaborcsardi commented 1 year ago

What is traceback() right after the error?

binvers is not a variable we ever use in devtools or remotes, so I suspect, that the error is not coming from us. The traceback will probably tell you where it is coming from.

Another thing you could try is using pak to install packages instead of devtools or remotes, it does a much better job: https://pak.r-lib.org.

jennybc commented 1 year ago

Yeah the error is originating from base R, although remotes is presumably an intermediary:

https://github.com/wch/r-source/blob/f14e7163f4e370a1a53bb4afbbb35feaad7fa538/src/library/utils/R/packages2.R#L485-L488

But @pachadotdev, chances are, whatever infelicity you're seeing in an outdated version of devtools or in remotes (which is in maintenance mode) ... the answer is almost certainly to use the current versions of all packages and to favor pak for getting your dependencies installed.

pachadotdev commented 1 year ago

@jennybc @gaborcsardi

I confirm it happens with devtools 2.4.3 but not 2.4.5. I did this to provide a full log that is 100% traceable.

1: Install Docker

sudo apt install docker.io
sudo systemctl start docker
sudo usermod -aG docker $USER
newgrp docker
docker --version
docker run hello-world
docker pull ubuntu
docker run -it ubuntu bash

2: Install R

I installed R in the VM by adapting these instructions (i.e., I'm not using sudo because docker logged me as root, and also docker does not provide the sudo command).

I also install r-base-dev, otherwise devtools installation will fail because r-base does not install make in the docker VM. libxml2-dev, libssl-dev and the other lib* are also required for devtools.

apt update && apt upgrade
apt install software-properties-common dirmngr wget git libxml2-dev libssl-dev libcurl4-openssl-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
apt install r-base-dev

3: Clone the R4DS in Spanish repository

cd ~
git clone --depth 1 https://github.com/cienciadedatos/r4ds
cd r4ds

4: Install devtools

R

R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
...

install.packages("devtools")
...

library(devtools)
library(remotes)

session_info()

- Session info -------------------------------------------------------------------------------------------------------------
 setting  value
 version  R version 4.3.0 (2023-04-21)
 os       Ubuntu 22.04.2 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C
 ctype    C
 tz       America/Toronto
 date     2023-05-20
 pandoc   NA

- Packages -----------------------------------------------------------------------------------------------------------------
 package     * version date (UTC) lib source
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.3.0)
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 devtools    * 2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.31  2022-12-11 [1] CRAN (R 4.3.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fs            1.6.2   2023-04-25 [1] CRAN (R 4.3.0)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.3.0)
 htmltools     0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpuv        1.6.11  2023-05-11 [1] CRAN (R 4.3.0)
 later         1.3.1   2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.3.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.0   2022-11-27 [1] CRAN (R 4.3.0)
 pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.3.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.3.0)
 processx      3.8.1   2023-04-18 [1] CRAN (R 4.3.0)
 profvis       0.3.8   2023-05-02 [1] CRAN (R 4.3.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps            1.7.5   2023-04-18 [1] CRAN (R 4.3.0)
 purrr         1.0.1   2023-01-10 [1] CRAN (R 4.3.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp          1.0.10  2023-01-22 [1] CRAN (R 4.3.0)
 remotes     * 2.4.2   2021-11-30 [1] CRAN (R 4.3.0)
 rlang         1.1.1   2023-04-28 [1] CRAN (R 4.3.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.7.4   2022-12-15 [1] CRAN (R 4.3.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
 usethis     * 2.1.6   2022-05-25 [1] CRAN (R 4.3.0)
 vctrs         0.6.2   2023-04-19 [1] CRAN (R 4.3.0)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] /usr/local/lib/R/site-library
 [2] /usr/lib/R/site-library
 [3] /usr/lib/R/library

----------------------------------------------------------------------------------------------------------------------------

5: Install R4DS dependencies

install()

The problem does not appear, but then terra fails and I had to run apt install libgdal-dev, which worked.

pachadotdev commented 1 year ago

also @jennybc @gaborcsardi, I created this repo to configure Ubuntu to install binary packages and also to install RStudio with apt install rstudio (stable and daily) https://github.com/pachadotdev/r-packages-ubuntu

jennybc commented 1 year ago

Ok glad to hear that using current versions works!