XVector installation fails because zlib.h is not found
2
1
Entering edit mode
RobKo ▴ 10
@8e5a2cab
Last seen 2.5 years ago
Netherlands

I've been trying to install DESeq2 for differential expression analysis. Unfortunately, installation keeps failing because the dependencies can not be installed. The culprit is the XVector package, that is required for one of DESeq2's dependencies. This is the error:

# Installing
if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install("DESeq2")

# Error
fatal error: zlib.h: No such file or directory
   16 | #include <zlib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [/usr/local/lib/R/etc/Makeconf:172: io_utils.o] Error 1
ERROR: compilation failed for package ‘XVector’
* removing ‘/usr/local/lib/R/site-library/XVector

Due to this zlib.h file that is not found, the installation fails. I'm working in rstudio hosted from a docker container based on the rocker/rstudio:4.0.5 (newer versions like 4.1.1 throw the same error). Installing zlib by running sudo apt-get install zlib1g in the docker container does not solve the problem, as zlib1g is already installed with the newest version.

I found that the error occurs even for an unaltered R 4.0.5, find the sessionInfo below.

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so

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

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

loaded via a namespace (and not attached):
[1] BiocManager_1.30.15 compiler_4.0.5      tools_4.0.5

Has anyone found a way to deal with zlib.h issues?

XVector docker Install • 3.6k views
ADD COMMENT
3
Entering edit mode
@gerhard-thallinger-1552
Last seen 5 weeks ago
Austria

Due to this zlib.h file that is not found, the installation fails. I'm working in rstudio hosted from a docker container based on the rocker/rstudio:4.0.5 (newer versions like 4.1.1 throw the same error). Installing zlib by running sudo apt-get install zlib1g in the docker container does not solve the problem, as zlib1g is already installed with the newest version.

If you are extending a rocker/rstudio image you should install the development version of some libraries (only they contain the header files which are needed to build the R-packages) and two additional libraries:

  apt-get install -y \
    libxml2 \
    libxt6 \
    zlib1g-dev \
    libbz2-dev \
    liblzma-dev \
    libpcre3-dev \
    libicu-dev \
    libjpeg-dev \
    libpng-dev \
    libxml2-dev \
    libglpk-dev
ADD COMMENT
0
Entering edit mode

Thanks for your answer, this indeed solves my problem. Initially when I tried your solution I ran into several errors relating to packages that are not available. I learned that apt-get update needs to be run in the rocker/rstudio based container to find the packages. Next I could run apt-get install zlib1g-dev to solve the problem that occurred with XVector and apt-get install libxml2-dev to deal with another error that would otherwise occur, for reference:

libxml2.so.2: cannot open shared object file: No such file or directory

After installing these two packages DESeq2 and all it's dependencies install without error.

ADD REPLY
1
Entering edit mode
@herve-pages-1542
Last seen 10 hours ago
Seattle, WA, United States

You're not showing how you're installing packages. I hope you're using BiocManager::install() which is the only safe way to install Bioconductor packages.

Using R 4.0.5 means BiocManager::install() will pick up Bioconductor 3.12, which is old and no longer supported. The current version is BioC 3.14 and requires R 4.1.2.

If you're into Docker containers, why not use the container that we provide? https://bioconductor.org/help/docker/

H.

ADD COMMENT
0
Entering edit mode

Thanks for your reply! I did use BiocManager::install() for installation (edited question to include this).

Using R 4.1.2 (from the rocker/rstudio:4.1.2 docker image) results in the same problem as the other version. I tried using the bioconductor image (bioconductor/bioconductor_docker:latest) and this works without issues. I noticed that this docker container uses 4.3GB of disk space, while the previous containers end up using about 2.3GB. However, that is fine for me at the moment.

ADD REPLY

Login before adding your answer.

Traffic: 570 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6