r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
331 stars 152 forks source link

issue installing devtools #683

Closed carlosaya2 closed 2 years ago

carlosaya2 commented 2 years ago

Hi all, I would appreciate your help

I have been trying to install devtools using install.packages ("devtools") however despite it starts running. itstops half way as it has some issues (see below), because of the libxml-2.0 failing to install. I am working on R studio (2021.09, R version 4.1.2) in ubuntu 18.04.06 LTS. However, on my Rstudio on my mac it installs perfectly. on my vm running ubuntu, it does not also install from github udsing devtools::install_github("r-lib/devtools"). I am ust starting to learn R so I will highly appreciate your help and guidance.

thank you heaps,

##########
Installing package into ‘/home/caya-bonilla/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘xml2’, ‘roxygen2’, ‘rversions’

trying URL 'https://cloud.r-project.org/src/contrib/xml2_1.3.3.tar.gz'
Content type 'application/x-gzip' length 283965 bytes (277 KB)
==================================================
downloaded 277 KB

trying URL 'https://cloud.r-project.org/src/contrib/roxygen2_7.1.2.tar.gz'
Content type 'application/x-gzip' length 267337 bytes (261 KB)
==================================================
downloaded 261 KB

trying URL 'https://cloud.r-project.org/src/contrib/rversions_2.1.1.tar.gz'
Content type 'application/x-gzip' length 42064 bytes (41 KB)
==================================================
downloaded 41 KB

trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.3.tar.gz'
Content type 'application/x-gzip' length 372413 bytes (363 KB)
==================================================
downloaded 363 KB

* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
** using staged installation
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lxml2
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘xml2’
* removing ‘/home/caya-bonilla/R/x86_64-pc-linux-gnu-library/4.1/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/home/caya-bonilla/R/x86_64-pc-linux-gnu-library/4.1/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/home/caya-bonilla/R/x86_64-pc-linux-gnu-library/4.1/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependencies ‘roxygen2’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/home/caya-bonilla/R/x86_64-pc-linux-gnu-library/4.1/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status
gaborcsardi commented 2 years ago

Have you tried following that advice:

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
carlosaya2 commented 2 years ago

sorry for late reply! yes, I did @gaborcsardi but there were many issues with that one, as other packages also need that type of installation. at the end it became own issue with the python version. I was using 2.7 and it required 3+

at the end, transferring the devtools folder installed on my Mac to my vm worked. not the most computer savvy :) but it has been working so far. hesitant to upgrade python to 3 as it may crash with current.

Thank you! sorry for very late reply

cheers

Carlos

gaborcsardi commented 2 years ago

I am glad that you worked this out.

In case somebody stumbles across this, I would note that

  1. devtools does not need Python, any version.
  2. copying installed packages between computers is usually not a good idea, unless they are same architecture and OS, but even then there might be problems.