Hi all, I have a problem when trying to install Rhtslib package on my computer. Apparently, the installer is unable to find the zlib.h header file. I have zlib installed and an independent installation of htslib is able to find a suitable header to use and works fine. Also, I'm able to locate the header file on my computer via the
The command used to install Rhtslib is:
Which results in the following output:
Bioconductor version 3.9 (BiocManager 1.30.4), R 3.6.1 (2019-07-05) Installing package(s) 'Rhtslib' trying URL 'https://bioconductor.org/packages/3.9/bioc/src/contrib/Rhtslib_1.16.1.tar.gz' Content type 'application/x-gzip' length 1470655 bytes (1.4 MB) ================================================== downloaded 1.4 MB * installing *source* package ‘Rhtslib’ ... ** using non-staged installation via StagedInstall field ** libs cd "htslib-1.7" && make -f "/home/juanenciso/anaconda3/envs/r_bioconductor/lib/R/etc/Makeconf" -f "Makefile.Rhtslib" make: Entering directory '/tmp/RtmpHYcN5n/R.INSTALL40d18c442c9/Rhtslib/src/htslib-1.7' Makefile.Rhtslib:130: warning: overriding recipe for target '.c.o' /home/juanenciso/anaconda3/envs/r_bioconductor/lib/R/etc/Makeconf:168: warning: ignoring old recipe for target '.c.o' x86_64-conda_cos6-linux-gnu-cc -g -Wall -O2 -fpic -I. -c -o kfunc.o kfunc.c x86_64-conda_cos6-linux-gnu-cc -g -Wall -O2 -fpic -I. -c -o knetfile.o knetfile.c x86_64-conda_cos6-linux-gnu-cc -g -Wall -O2 -fpic -I. -c -o kstring.o kstring.c x86_64-conda_cos6-linux-gnu-cc -g -Wall -O2 -fpic -I. -c -o bcf_sr_sort.o bcf_sr_sort.c 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> ^~~~~~~~
I'm attaching my session information:
> sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-conda_cos6-linux-gnu (64-bit) Running under: Manjaro Linux Matrix products: default BLAS/LAPACK: /home/juanenciso/anaconda3/envs/r_bioconductor/lib/R/lib/libRblas.so locale:  LC_CTYPE=en_GB.utf8 LC_NUMERIC=C  LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.utf8  LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.utf8  LC_PAPER=en_GB.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages:  stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached):  BiocManager_1.30.4 compiler_3.6.1 tools_3.6.1
Thank you, that worked!
Maybe worth pointing out that this solution is appropriate if you are already using conda, which is apparent from your sessionInfo(); I think the 'best practice' is, if you've chosen to use conda always use conda.
If you hadn't chosen to use conda, then likely Rhtslib would have installed without trouble, or if there were a problem then using conda for this package alone would not be the solution -- if you haven't chosen to use conda, don't use conda.
Yes, I should have elaborated in my answer that this falls under the 'If you install R with conda, install R packages with conda' paradigm.
I have seen instances of system libraries like zlib installed via conda, but then R built from source using these libraries, and I'm not sure if that falls under 'choosing to use conda' or 'not choosing to use conda'.