abdenlab / oxbow

Read specialized NGS formats as data frames in R, Python, and more.
https://lifeinbytes.substack.com/p/breaking-out-of-bioinformatic-data-silos
Apache License 2.0
58 stars 8 forks source link

r-oxbow installation fails #8

Closed rmflight closed 1 year ago

rmflight commented 1 year ago

R-Version: 4.3.0 OS: Pos!OS (Ubuntu variant) rust-Version: rustc 1.69.0 (84c898d65 2023-04-16)

I've cloned the repo to make sure I can build the local r-oxbow.

cd r-oxbow/src/rust
cargo build

This works fine. Detects the oxbow in the directory above and installs it fine.

remotes::install_local("r-oxbow")

Generates this output:

── R CMD build ─────────────────────────────────────────────────────────────────
✔  checking for file ‘/tmp/RtmpjHZ4Kt/file34ed022cec682/r-oxbow/DESCRIPTION’ ...
─  preparing ‘oxbow’: (2.1s)
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts (425ms)
─  checking for empty or unneeded directories
─  building ‘oxbow_0.0.0.9000.tar.gz’

* installing *source* package ‘oxbow’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
rm -Rf oxbow.so ./rust/target/release/liboxbow.a entrypoint.o
gcc -I"/rmflight_stuff/software/R-4.3.0/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -c entrypoint.c -o entrypoint.o
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
# to set it here to ensure cargo can be invoked. It is appended to PATH and
# therefore is only used if cargo is absent from the user's PATH.
if [ "" != "true" ]; then \
    export CARGO_HOME=/tmp/RtmpxvOvG8/R.INSTALL34f23e7aef79/oxbow/src/.cargo; \
fi && \
    export PATH="/opt/TinyTeX/bin/x86_64-linux/:/opt/TinyTeX/bin/x86_64-linux/:/home/rmflight/.cargo/bin:/home/rmflight/anaconda3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/rmflight/.local/bin:/home/rmflight/bin:/bin/java/:/software/julia-1.0.5/bin:/home/rmflight/.cargo/bin:/opt/TinyTeX/bin/x86_64-linux/:/home/rmflight/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/rmflight/.cargo/bin" && \
    cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir ./rust/target
error: failed to get `oxbow` as a dependency of package `r-oxbow v0.1.0 (/tmp/RtmpxvOvG8/R.INSTALL34f23e7aef79/oxbow/src/rust)`

Caused by:
  failed to load source for dependency `oxbow`

Caused by:
  Unable to update /tmp/RtmpxvOvG8/R.INSTALL34f23e7aef79/oxbow

Caused by:
  failed to read `/tmp/RtmpxvOvG8/R.INSTALL34f23e7aef79/oxbow/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
make: *** [Makevars:16: rust/target/release/liboxbow.a] Error 101
ERROR: compilation failed for package ‘oxbow’
* removing ‘/rmflight_stuff/software/R-4.3.0/library/oxbow’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpjHZ4Kt/file34ed0a9f21f9/oxbow_0.0.0.9000.tar.gz’ had non-zero exit status

Same error if I use:

remotes::install_github("abdenlab/oxbow", subdir="r-oxbow")
manzt commented 1 year ago

Thanks for opening the issue! I was able to reproduce on my machine. It seems remotes::install_* is having an issue resolving the oxbow dependency (our "core" rust crate oxbow/Cargo.toml) in the r-oxbow/src/rust/Cargo.toml.

My guess is that the isolated environment it creates to build the package does not copy the source code from outside the R project root. I will look into how to link the dependencies correctly for remotes::.

In the mean time, since you have the repo cloned locally, you should be able to test out oxbow with:

cd r-oxbow
rextendr::document()
devtools::load_all(".")

library(oxbow)

More information can be found in the rextendr docs.

manzt commented 1 year ago

Found a similar issue,

but the current answer is rather unsatisfactory (move all the rust code into R project). I guess we could change the r-oxbow/src/rust/Cargo.toml to use the published version of the oxbow crate, but that kind of defeats the purpose of the mono repo. Will still try to test out some alternative solutions.

I definitely want to make it a priority that folks can try out the R oxbow package with remotes or devtools.

nvictus commented 1 year ago

This has been documented in #9 until we have a more satisfactory solution.

nvictus commented 1 year ago

@rmflight it should work now. If you give it another try and still run into problems, please re-open.

rmflight commented 1 year ago

It installs now!