paws-r / paws

Paws, a package for Amazon Web Services in R
https://www.paws-r-sdk.com
Other
309 stars 37 forks source link

Unable to install paws.common 0.6.3 from CRAN #706

Closed fh-mthomson closed 8 months ago

fh-mthomson commented 8 months ago

Thank you for the recent 0.6.3 release! Unfortunately, I'm having issues installing from CRAN (running on Workbench hosted on Ubuntu jammy):

Installing from https://cran.rstudio.com/:

> install.packages('paws.common')
Installing package into ‘/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/paws.common_0.6.3.tar.gz'
Content type 'application/x-gzip' length 112727 bytes (110 KB)
==================================================
downloaded 110 KB

* installing *source* package ‘paws.common’ ...
** package ‘paws.common’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG  -I'/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++14 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG  -I'/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c encoding.cpp -o encoding.o
g++ -std=gnu++14 -shared -L/opt/R/4.1.3/lib/R/lib -L/usr/local/lib -o paws.common.so RcppExports.o encoding.o -L/opt/R/4.1.3/lib/R/lib -lR
installing to /home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-paws.common/00new/paws.common/libs
** R
** byte-compile and prepare package for lazy loading
Loading required package: usethis
** help
*** installing help indices
** building package indices
Loading required package: usethis
** testing if installed package can be loaded from temporary location
Loading required package: usethis
Error: package or namespace load failed for ‘paws.common’:
 .onLoad failed in loadNamespace() for 'paws.common', details:
  call: `[<-`(`*tmp*`, found, 2, value = "")
  error: (subscript) logical subscript too long
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/paws.common’
Warning in install.packages :
  installation of package ‘paws.common’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpjrTKL0/downloaded_packages’

Similarly, pulling from 54db5e3f10a1fae0eea56a3c3207ea464e4ab78e :

> remotes::install_github("paws-r/paws/paws.common", ref = "54db5e3f10a1fae0eea56a3c3207ea464e4ab78e")
Downloading GitHub repo paws-r/paws@54db5e3f10a1fae0eea56a3c3207ea464e4ab78e
'/usr/bin/git' clone --depth 1 --no-hardlinks --recurse-submodules https://github.com/aws/aws-sdk-js /tmp/RtmpjrTKL0/remotes11b33c47acbd/paws-r-paws-54db5e3/paws.common/../vendor/aws-sdk-js
Cloning into '/tmp/RtmpjrTKL0/remotes11b33c47acbd/paws-r-paws-54db5e3/paws.common/../vendor/aws-sdk-js'...
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/tmp/RtmpjrTKL0/remotes11b33c47acbd/paws-r-paws-54db5e3/paws.common/DESCRIPTION’ (346ms)
─  preparing ‘paws.common’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘paws.common_0.6.3.tar.gz’
   Warning in sprintf(gettext(fmt, domain = domain), ...) :
     one argument not used by format 'invalid uid value replaced by that for user 'nobody''
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning in sprintf(gettext(fmt, domain = domain), ...) :
     one argument not used by format 'invalid gid value replaced by that for user 'nobody''
   Warning: invalid gid value replaced by that for user 'nobody'

Installing package into ‘/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘paws.common’ ...
** using staged installation
** libs
g++ -std=gnu++14 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG  -I'/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++14 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG  -I'/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c encoding.cpp -o encoding.o
g++ -std=gnu++14 -shared -L/opt/R/4.1.3/lib/R/lib -L/usr/local/lib -o paws.common.so RcppExports.o encoding.o -L/opt/R/4.1.3/lib/R/lib -lR
installing to /home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-paws.common/00new/paws.common/libs
** R
** byte-compile and prepare package for lazy loading
Loading required package: usethis
** help
*** installing help indices
** building package indices
Loading required package: usethis
** testing if installed package can be loaded from temporary location
Loading required package: usethis
Error: package or namespace load failed for ‘paws.common’:
 .onLoad failed in loadNamespace() for 'paws.common', details:
  call: `[<-`(`*tmp*`, found, 2, value = "")
  error: (subscript) logical subscript too long
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1/paws.common’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpjrTKL0/file11b3240e7aaf/paws.common_0.6.3.tar.gz’ had non-zero exit status
DyfanJones commented 8 months ago

Hi @fh-mthomson

Interesting the dockerfile from https://github.com/paws-r/paws/blob/main/docker/rocker-r-base/dockerfile builds successfully on my machine. I will spin up a sagemaker instance on AWS to see if i can mimic this behaviour :)

DyfanJones commented 8 months ago

@fh-mthomson what version of R are you using.

fh-mthomson commented 8 months ago

thanks for the pointer! One issue was that I was missing libcurl4-openssl-dev in the Docker image. pak ftw:

> pak::pak("paws.common")
✔ Loading metadata database ... done

✖ Missing 1 system package. You'll probably need to install it manually:
+ libcurl4-openssl-dev  - curl
ℹ No downloads are needed
✔ 1 pkg + 12 deps: kept 13 [6.3s]

After adding libcurl4-openssl-dev, the following now works:

> pak::pak("paws.common")
✔ Updated metadata database: 766.45 kB in 2 files.                        
✔ Updating metadata database ... done                                     

→ Will update 1 package.
→ Will download 1 CRAN package (112.73 kB).
+ paws.common 0.6.3 → 0.6.3 [bld][cmp][dl] (112.73 kB) + ✔ pandoc
✔ All system requirements are already installed.

? Do you want to continue (Y/n) y
ℹ Getting 1 pkg (112.73 kB)
✔ Cached copy of paws.common 0.6.3 (source) is the latest build
✔ No downloads needed, all packages are cached                      
ℹ Building paws.common 0.6.3
✔ Built paws.common 0.6.3 (538ms)                                      
✔ Installed paws.common 0.6.3  (1.2s)                                    
✔ 1 pkg + 12 deps: kept 12, upd 1 [25.9s]   

However, it's still failing when installing directly from GitHub (or the source package):

# 0.6.3 fails
devtools::install_github("paws-r/paws/paws.common@54db5e3f10a1fae0eea56a3c3207ea464e4ab78e")

# 0.6.2 passes
devtools::install_github("paws-r/paws/paws.common@a96713f69d53c26ffe8134e2d5a35b3c73a9a057")

I'm using R 4.1.3, but have also replicated the issue on 4.2.3.

Of note, I'm installing packages from PPM (repo option: https://packagemanager.posit.co/cran/__linux__/jammy/latest), so there is pretty good binary availability. But, the package should still be installable from source, so this seems like a subtle regression.

DyfanJones commented 8 months ago

Thanks for the in-depth analysis. I will try and replicate the issue tomorrow. I am racking my brain trying to think what could of caused it 😔

fh-mthomson commented 8 months ago

Thank you for investigating and the quick responses! Looks like this is also impacting others: https://github.com/cran/paws.common/issues/1#issue-1983996934

fh-mthomson commented 8 months ago

Here's the offending line: https://github.com/paws-r/paws/blob/33de2e8a6362395acdcd40caf8b95a1c1066dd2d/paws.common/R/cache.R#L14

I cloned the package, then after loading:

image

Commenting out, then reloading:

> set_os_env_cache()
Error in `[<-`(`*tmp*`, found, 2, value = "") : 
  (subscript) logical subscript too long