harrelfe / Hmisc

Harrell Miscellaneous
Other
204 stars 81 forks source link

Use of native pipe brings R >= 4.1 dependency #159

Closed pdmetcalfe closed 7 months ago

pdmetcalfe commented 1 year ago

Hi!

Thanks for the very wonderful rms and Hmisc!

Just noticed that Hmisc 5 uses the native pipe operator |> (in R/movStats.r), which requires R >= 4.1. This I think should be listed in DESCRIPTION (at least for the benefit of dinosaurs like me who are still on R 4.0):

Depends: R (>= 4.1)
hfrick commented 1 year ago

I maintain the censored package, which indirectly depends on Hmisc. The use of the native pipe now breaks the CI runs for censored on any R version < 4.1. Would it be possible to not use the new pipe instead of bumping the minimum version, please? I only spot two instances of the native pipe being used: https://github.com/harrelfe/Hmisc/blob/b80593b82ed0e6b12f8eab42156d8b7869dc1723/R/movStats.r#L398-L399

camelest commented 1 year ago

Hi, thank you so much for pointing out this. I'm having the same problems installing Hmisc in R < v4.0. Is there any workaround currently as an end user? Thank you so much for your help. @pdmetcalfe @hfrick

tyner commented 1 year ago

Hi, thank you so much for pointing out this. I'm having the same problems installing Hmisc in R < v4.0. Is there any workaround currently as an end user? Thank you so much for your help. @pdmetcalfe @hfrick

@camelest, at this point your options are:

  1. use a newer version of R
  2. use an older version of Hmisc (see here)
  3. use a version of Hmisc where R/movStats.r has been patched to remove the pipe dependency
camelest commented 1 year ago

@tyner Thank you so much for your prompt reply! I will try these.

al-obrien commented 1 year ago

There was an interesting section from a Posit blog on some advice when using the new pipe in packages:

https://www.tidyverse.org/blog/2023/04/base-vs-magrittr-pipe/#using-the-native-pipe-in-packages

mmokrejs commented 10 months ago

This bug got introduced in Hmis-5.0. One cannot use Hmisc-4.8 and older as they have have another issue:

* installing to library ‘/home/bionic/R/x86_64-pc-linux-gnu-library/3.5’
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** libs
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c Hmisc.c -o Hmisc.o
f95   -fpic  -g -O2  -c cidxcn.f -o cidxcn.o
f95   -fpic  -g -O2  -c cidxcp.f -o cidxcp.o
f95   -fpic  -g -O2  -c hoeffd.f -o hoeffd.o
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c init.c -o init.o
f95   -fpic  -g -O2  -c jacklins.f -o jacklins.o
f95   -fpic  -g -O2  -c largrec.f -o largrec.o
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c mChoice.c -o mChoice.o
f95   -fpic  -g -O2  -c maxempr.f -o maxempr.o
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c nstr.c -o nstr.o
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c ranksort.c -o ranksort.o
f95   -fpic  -g -O2  -c rcorr.f -o rcorr.o
gcc -I"/opt/R/3.5.3/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c string_box.c -o string_box.o
f95   -fpic  -g -O2  -c wclosest.f -o wclosest.o
gcc -shared -L/opt/R/3.5.3/lib/R/lib -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o init.o jacklins.o largrec.o mChoice.o maxempr.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -lgfortran -lm -lquadmath -L/opt/R/3.5.3/lib/R/lib -lR
installing to /home/bionic/R/x86_64-pc-linux-gnu-library/3.5/Hmisc/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error : objects ‘useOuterStrips’, ‘resizePanels’ are not exported by 'namespace:latticeExtra'
ERROR: lazy loading failed for package ‘Hmisc’
* removing ‘/home/bionic/R/x86_64-pc-linux-gnu-library/3.5/Hmisc’
* restoring previous ‘/home/bionic/R/x86_64-pc-linux-gnu-library/3.5/Hmisc’
Hmisc_4.8-0.tar.gz failed to install, trying next
couthcommander commented 10 months ago

@mmokrejs Regarding the "latticeExtra" error within Hmisc, what version of "latticeExtra" do you have installed, and can you install the latest (0.6-30)? Those two functions should not be causing an error here.

tyner commented 10 months ago

@mmokrejs yeah, try downgrading to an older version of latticeExtra? For example under R version 4.0.2 with latticeExtra version 0.6-28, I am able to install Hmisc version 4.8.

> packageVersion("Hmisc")
[1] ‘4.8.0’
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-koji-linux-gnu (64-bit)
Running under: Amazon Linux 2

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Hmisc_4.8-0     ggplot2_3.4.1   Formula_1.2-5   survival_3.2-7 
[5] lattice_0.20-41

loaded via a namespace (and not attached):
 [1] pillar_1.9.0        compiler_4.0.2      RColorBrewer_1.1-3 
 [4] tools_4.0.2         base64enc_0.1-3     rpart_4.1-15       
 [7] digest_0.6.33       lifecycle_1.0.3     tibble_3.2.1       
[10] gtable_0.3.1        htmlTable_2.4.1     checkmate_2.2.0    
[13] pkgconfig_2.0.3     rlang_1.0.6         Matrix_1.2-18      
[16] rstudioapi_0.15.0   cli_3.6.1           xfun_0.40          
[19] fastmap_1.1.1       gridExtra_2.3       stringr_1.5.0      
[22] withr_2.5.0         cluster_2.1.0       knitr_1.44         
[25] vctrs_0.5.2         htmlwidgets_1.6.2   grid_4.0.2         
[28] nnet_7.3-14         data.table_1.14.8   glue_1.6.2         
[31] R6_2.5.1            fansi_1.0.4         foreign_0.8-80     
[34] latticeExtra_0.6-28 magrittr_2.0.3      scales_1.2.1       
[37] backports_1.4.1     htmltools_0.5.6     splines_4.0.2      
[40] colorspace_2.1-0    utf8_1.2.3          stringi_1.7.12     
[43] munsell_0.5.0
couthcommander commented 10 months ago

Ha, how's that for conflicting advice? At the very least, for some version of "latticeExtra", you should be able to install Hmisc. Try @tyner's suggestion with 0.6-28. I'll try to persuade @harrelfe into dropping the pipe/4.1 dependency.

tyner commented 10 months ago

Good times. This is getting off topic, but newer versions of latticeExtra introduce a dependency on the jpeg package which may require installing a system library.

* installing *source* package ‘jpeg’ ...
** package ‘jpeg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG   -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches    -m64 -mtune=generic  -c read.c -o read.o
In file included from read.c:1:0:
rjcommon.h:11:10: fatal error: jpeglib.h: No such file or directory
 #include <jpeglib.h>
          ^~~~~~~~~~~
compilation terminated.
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘jpeg’
mmokrejs commented 10 months ago

@mmokrejs Regarding the "latticeExtra" error within Hmisc, what version of "latticeExtra" do you have installed, and can you install the latest (0.6-30)? Those two functions should not be causing an error here.

@couthcommander latticeExtra_0.1-1. I could upgrade to latticeExtra_0.6-28, not newer as latticeExtra_0.6-29.tar.gz requires >=R-3.6.0

mmokrejs commented 10 months ago

@tyner Well, indeed Hmisc-4.8 got installed now, interresting. So if it would require somewhat newer latticeExtra it would have worked out of the box. Thank you.

Definitely, the native stuff introduces such an extra blocker if one needs to stick to some older version of packages that it is truly a nightmare.

harrelfe commented 7 months ago

I'm not inclined to support such old versions of R.