Bioconductor / Rhtslib

HTSlib high-throughput sequencing library as an R package
https://bioconductor.org/packages/Rhtslib
11 stars 12 forks source link

Cannot install Rhtslib from R in conda environment #9

Closed naumenko-sa closed 5 years ago

naumenko-sa commented 5 years ago

Hello!

Thanks for the useful package!

I've installed R 3.6.0 in conda enviroment:

R --version
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)

I cannot install Rhtslib from R:

BiocManager::install("Rhtslib")
...
x86_64-conda_cos6-linux-gnu-cc -g -Wall -O2 -fpic -I.  -c -o bgzf.o bgzf.c
In file included from bgzf.c:39:0:
htslib/bgzf.h:35:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.
make[1]: *** [Makefile.Rhtslib:130: bgzf.o] Error 1

You might say, that I should install via conda, i.e.

conda install -c bioconda bioconductor-rhtslib

Unfortunately, it is not an option here, as it downgrades R and many other packages to 3.5.1.

You might say, that it is a conda's issue rather than Rhtslib's one. However, I've installed many other packages from that R and they all found their includes. Includes are definitely there:

/path/.conda/envs/r/include/zlib.h

Also I have a system-wide one:

/usr/include/zlib.h

R CMD INSTALL approach is not working as well:

export RHTSLIB_RPATH=/path/.conda/envs/r/include; R CMD INSTALL Rhtslib_1.17.1.tar.gz
(causing the same zlib.h error)

Low level configure/make/make install approach was not successful:

./configure --includedir=/path/.conda/envs/r/include --prefix=/path/.conda/envs/r/lib/R/library

Also, I tried to install and load zlibbioc package - same error.

Could you please suggest how to install Rhtslib in that case?

Sergey

mtmorgan commented 5 years ago

Not an answer (maybe one will be forthcoming) but it is somehow a conda problem, resolving zlib.h. Here'a different approach, that 'just works'. T

docker pull bioconductor/bioconductor_full:RELEASE_3_9
mkdir /tmp/mylib
docker run -it -v /tmp/mylib:/usr/local/lib/R/host-site-library \
    bioconductor/bioconductor_full:RELEASE_3_9 R \
   -e "BiocManager::install('Rhtslib')"

The use of -v makes the library installation persistent across docker runs; one would do something similar for data access.

docker run -it -v /tmp/mylib:/usr/local/lib/R/host-site-library \
    bioconductor/bioconductor_full:RELEASE_3_9 R \
   -e "library(Rhtslib)"

See https://github.com/Bioconductor/bioconductor_full

adityabandla commented 5 years ago

I ran into the same issue. You need to set CPPFLAGS and LDFLAGS in the makefiles

wget https://bioconductor.org/packages/release/bioc/src/contrib/Rhtslib_1.16.1.tar.gz
tar xvzf Rhtslib_1.16.1.tar.gz
cd Rhtslib/src/htslib-1.7/

In this directory, change the flags in the Makefile and Makefile.Rhtslib and then

R CMD INSTALL Rhtslib_1.16.1.tar.gz`
auberginekenobi commented 5 years ago

Following @adityabandla 's comment... For the confused, the exact edits you need to make are:

which are the edits proposed in #8 . Then, re-tar it: tar -czvf Rhtslib_1.16.1.tar.gz ./Rhtslib/ and R CMD INSTALL as described.

Can confirm it worked for my conda R installation (3.6.1).

hpages commented 5 years ago

Thanks for the feedback. @landesfeind's PR should address this. I'll look at it and apply it ASAP.

leachim commented 5 years ago

I would appreciate if you could deal with this PR in the near future. It's quite ugly to deal with this manually and a couple of downstream packages appear to depend on it. Many thanks!

kasperdanielhansen commented 5 years ago

This issue, which I am currently facing, is identical to issue #3. I have submitted a PR.

hpages commented 5 years ago

Hi guys,

Sorry for the delay. This should be fixed now. See https://github.com/Bioconductor/Rhtslib/pull/8#issuecomment-531909522

If every goes well on tomorrow's build report (https://bioconductor.org/checkResults/3.10/bioc-LATEST/Rhtslib/merida1-install.html), I'll port to the RELEASE_3_9 branch.

Best, H.