can not install tidyverse in ubuntu 20.04

I use ubuntu 20.04 and install R version 4.1.0 , now i want install tidyverse package but get this error:

    2 | #include <zlib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: readstat/spss/readstat_zsav_read.o] Error 1
ERROR: compilation failed for package ‘haven’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/4.1/haven’
Warning in install.packages :
  installation of package ‘haven’ had non-zero exit status
ERROR: dependency ‘haven’ is not available for package ‘tidyverse’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/4.1/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

and when install haven package get an error that say:

    2 | #include <zlib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: readstat/spss/readstat_zsav_read.o] Error 1
ERROR: compilation failed for package ‘haven’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/4.1/haven’
Warning in install.packages :
  installation of package ‘haven’ had non-zero exit status

how can resolve these errors?

Hi,

I know from experience it can be a pain sometimes to install packages on Linux :slight_smile: Have you tied installing the package Haven separately first? Does it produce the same error then?

PJ

yes, i installing first package haven, but get similar error!!!

I suspect you are missing some "dev" packages at the linux level. Perhaps try

sudo apt install zlib1g-dev
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.