david-cortes / isotree

(Python, R, C/C++) Isolation Forest and variations such as SCiForest and EIF, with some additions (outlier detection + similarity + NA imputation)
https://isotree.readthedocs.io
BSD 2-Clause "Simplified" License
186 stars 38 forks source link

R package build from source failing on Conda Forge #56

Closed mfansler closed 9 months ago

mfansler commented 9 months ago

We're seeing an error on the Conda Forge builds for this package. Essentially, we download and unpack the tarball from CRAN, then run

R CMD INSTALL --build .

However, this has been resulting in a configure error since v0.5.22:

* installing to library ‘/home/conda/feedstock_root/build_artifacts/r-isotree_1701323302199/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/R/library’
* installing *source* package ‘isotree’ ...
** package ‘isotree’ successfully unpacked and MD5 sums checked
** using staged installation
configure: error: cannot find sources (isotree) in . or ..
ERROR: configuration failed for package ‘isotree’

Any idea why this would be happening? Are changes in the configure script incompatible with installing from unpacked source?

Thanks in advance for any insight!

david-cortes commented 9 months ago

Thanks for the bug report and sorry about these problems. The latest version of this package requires R >= 4.3.

While that requirement is currently (0.5.24-1) added to DESCRIPTION, I unfortunately forgot to add that requirement to one of the last CRAN uploads (0.5.24), so it's currently failing in some CRAN checks which aren't pulling the latest version of this package.

I was informed by CRAN that I need to solve this issue, so I'm thinking of the following workaround:

First step should be completed very soon.

mfansler commented 9 months ago

Thanks for the heads up. Just FYI, that we still see the same issue in 0.5.24-2 (Conda Forge PR). I think unlike CRAN, we unpack the tarball before building from source and the configure file seems somehow to be incompatible with this.

david-cortes commented 9 months ago

Thanks for the information. I am unfortunately not familiar with conda packaging so I'm afraid I cannot offer much help.

A couple thoughts:

Are you able to provide a Dockerfile here that would reproduce the error that you are seeing?

david-cortes commented 9 months ago

Also, I'm not sure if I got this right, but from some quick look at the logs there, it looks like you are extracting the package's contents to this folder:

/home/conda/feedstock_root/build_artifacts/r-isotree_1701432284233/work

Which is saved in env. var SRC_DIR.

However, I don't see this SRC_DIR later on used to specify some R env. var or path, only cmake variables. Do those still work for autoconf?

mfansler commented 9 months ago

Thanks for the responses. Yes, we can easily swap in a fixed Makevars for the dynamic configure approach. I've done that and seems fine. 🚀

Some responses to your questions:

For the configure script changes, I see you dropped the version in the configure.ac, but that actually removed a bit more info in the rendered configure file. Here's the relevant snippet of the diff at the bisection (0.5.20...0.5.22):

diff --git a/configure b/configure
index 7dbbffd..5512076 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for isotree 0.5.18.
+# Generated by GNU Autoconf 2.71.
 #
 #
 # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -605,13 +605,14 @@ MFLAGS=
 MAKEFLAGS=

 # Identity of this package.
-PACKAGE_NAME='isotree'
-PACKAGE_TARNAME='isotree'
-PACKAGE_VERSION='0.5.18'
-PACKAGE_STRING='isotree 0.5.18'
+PACKAGE_NAME=''
+PACKAGE_TARNAME=''
+PACKAGE_VERSION=''
+PACKAGE_STRING=''
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''

+ac_unique_file="isotree"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 LD_SUPPORT
mfansler commented 9 months ago

I'll leave this at your discretion to close or leave open. For practical purposes, I'm satisfied with the workaround. But it is an odd bug and first time I've seen it.

david-cortes commented 9 months ago

Thanks for the hint. I've added back the version number to the configure script in case it causes installation issues elsewhere.

Still odd that it fails like that, since running ./configure from the root folder of the de-compressed CRAN .tar.gz file works fine for me.

mfansler commented 9 months ago

Still odd that it fails like that, since running ./configure from the root folder of the de-compressed CRAN .tar.gz file works fine for me.

Yeah, I also did a local test on unpacked CRAN tarball and R CMD INSTALL --build . worked fine. 🤷

david-cortes commented 9 months ago

A wild idea: could it be that the environment you are using in the conda-forge build is using a shell with less features than mainstream ones like bash when executing the configure script, and the configure script somehow ended up including some non-posix code that's not supported there?