ANTICONF ERROR: cannot install V8 R package - r

I'm trying to install V8 rpackage on Ubuntu 18.04.1 LTS.
The version of R used is R 3.5.1.
I proceeded as follows:
I installed libv8 by typing : sudo apt-get install -y libv8-3.14-dev
I type this command to install in R : install.packages("V8")
Then, I received this error:
package ‘V8’ correctement décompressé et sommes MD5 vérifiées
Using PKG_CFLAGS=-I/usr/include/v8-3.14
Using PKG_LIBS=-lv8
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because was not found. Try installing:
deb: libv8-3.14-dev (formerly: libv8-dev) (Debian, Ubuntu)
rpm: v8-314-devel (formerly: v8-devel) (Fedora, EPEL)
brew: v8#3.15 (OSX) -- NOT regular v8! Tap from homebrew/versions
csw: libv8_dev (Solaris)
To use a custom libv8, set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
ERROR: configuration failed for package ‘V8’
removing ‘/opt/Anaconda/Anaconda3-5.1.0/envs/mro_env/lib/R/library/V8’
restoring previous ‘/opt/Anaconda/Anaconda3-5.1.0/envs/mro_env/lib/R/library/V8’
Warning message:
In install.packages("/home/ben/Bureau/miniCRAN/src/contrib/V8_1.5.tar.gz", :
l'installation du package ‘/home/ben/Bureau/miniCRAN/src/contrib/V8_1.5.tar.gz’ a eu un statut de sortie non nul
Then, I check if i have installed libv8 correctly by typing:
(mro_env) root#ben-Aspire-E5-575G:/opt/Anaconda/Anaconda3-5.1.0# find /lib* /usr/lib* -name 'libv8'
/usr/lib/libv8.so
/usr/lib/libv8.so.3.14.5
And
(mro_env) root#ben-Aspire-E5-575G:/opt/Anaconda/Anaconda3-5.1.0# ldconfig -p | grep libv8
libv8.so.3.14.5 (libc6,x86-64) => /usr/lib/libv8.so.3.14.5
libv8.so (libc6,x86-64) => /usr/lib/libv8.so
but when I verify if libv8.pc exists in /usr/lib/pkgconfig/ I didn't find it.
I'm stuck and I do not know how I can solve this problem.

Try this in R from Jeroem Ooms:
# For Linux: download libv8 during installation
Sys.setenv(DOWNLOAD_STATIC_LIBV8=1)
install.packages("V8")

Related

Airflow: RScript : Error in library(httr) : there is no package called ‘httr’

Requirement: To install R Packages in Airflow to execute the RScript in Airflow
Tried: Below commands in DockerFile
# Global Docker Build arguments
ARG AIRFLOW_VERSION=2.3.3
ARG PYTHON_RUNTIME_VERSION=3.8
FROM apache/airflow:${AIRFLOW_VERSION}-python${PYTHON_RUNTIME_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-e", "-u", "-x", "-c"]
USER 0
RUN apt-get update && apt-get install -y r-base r-base-core && \
rm -r /var/lib/apt/lists/*
RUN R -e "install.packages('httr', repos='https://cran.rstudio.com/')"
RUN R -e "install.packages('jsonlite', repos='http://cran.rstudio.com/')"
Error : Error in library(httr) : there is no package called ‘httr’
Also Tried another by including in the RScript as
install.packages("httr")
install.packages("jsonlite")
library(httr)
library(jsonlite)
Got error as
Running command: ['Rscript', '/opt/airflow/dags/r_scripts/R_script.R']
[2023-01-04, 16:57:58 UTC] {subprocess.py:85} INFO - Output:
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - Installing package into ‘/usr/local/lib/R/site-library’
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - (as ‘lib’ is unspecified)
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - Warning in install.packages("httr") :
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - 'lib = "/usr/local/lib/R/site-library"' is not writable
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - Error in install.packages("httr") : unable to install packages
[2023-01-04, 16:57:58 UTC] {subprocess.py:92} INFO - Execution halted
[2023-01-04, 16:57:58 UTC] {subprocess.py:96} INFO - Command exited with return code 1
You are running into errors during compilation that are causing cascading errors. When in trouble building R images, since the docker build process often masks/hides some of the real error messages, I run a container before the installation phase to see what's going on. If we do that, we'll see errors such as:
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.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 ‘curl’
* removing ‘/home/airflow/R/x86_64-pc-linux-gnu-library/4.0/curl’
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.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 MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
1 | #include <openssl/opensslv.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/airflow/R/x86_64-pc-linux-gnu-library/4.0/openssl’
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/airflow/R/x86_64-pc-linux-gnu-library/4.0/httr’
The downloaded source packages are in
‘/tmp/Rtmp9dyEo5/downloaded_packages’
When you see this, it should be clear: you have OS-level dependencies that are not met. While the CRAN page for httr is uninformative here, know that it relies on curl, which lists:
SystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb).
If you dive a little deeper, you'll see that we need to add that package as well as libssl-dev.
I only tested against the initial few portions of your Dockerfile, but I was able to build this and confirm that R sees these two new packages. (I also took the liberty of installing both packages in one RUN line, thinking that fewer images in the build process was a good thing.)
ARG AIRFLOW_VERSION=2.3.3
ARG PYTHON_RUNTIME_VERSION=3.8
FROM apache/airflow:${AIRFLOW_VERSION}-python${PYTHON_RUNTIME_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-e", "-u", "-x", "-c"]
USER 0
RUN apt-get update && apt-get install -y r-base r-base-core r-base-dev \
libcurl4-openssl-dev libssl-dev && \
rm -r /var/lib/apt/lists/*
RUN R -e "install.packages(c('httr', 'jsonlite'), repos='https://cran.rstudio.com/')"
The build:
$ docker build -t myimage .
[+] Building 20.5s (7/7) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 474B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/apache/airflow:2.3.3-python3.8 0.7s
=> [1/3] FROM docker.io/apache/airflow:2.3.3-python3.8#sha256:3a17e765ce209eb6cc551518f3b7ad5e2126d509ca8bdd35232ed2d35f801049 0.0s
=> CACHED [2/3] RUN apt-get update && apt-get install -y r-base r-base-core r-base-dev libcurl4-openssl-dev libssl-dev && rm -r /var/lib/apt/lists/* 0.0s
=> [3/3] RUN R -e "install.packages(c('httr', 'jsonlite'), repos='https://cran.rstudio.com/')" 19.6s
=> exporting to image 0.2s
=> => exporting layers 0.1s
=> => writing image sha256:6271d7deb41211a7fa603a086f8cc24d1249d831546e2fec0293d87d14558312 0.0s
=> => naming to docker.io/library/myimage
Confirm:
$ docker run -it --rm myimage bash
The container is run as root user. For security, consider using a regular user account.
root#10f43b1bd4c2:/opt/airflow# ls /usr/local/lib/R/site-library/
R6 askpass curl httr jsonlite mime openssl sys
root#10f43b1bd4c2:/opt/airflow# R
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> packageVersion("httr")
[1] ‘1.4.4’
> packageVersion("jsonlite")
[1] ‘1.8.4’
> q("no")

ERROR: configuration failed for package ‘ragg’

> install.packages("ragg")
trying URL 'https://cloud.r-project.org/src/contrib/ragg_1.1.3.tar.gz'
Content type 'application/x-gzip' length 420401 bytes (410 KB)
==================================================
downloaded 410 KB
Welcome at Tue Aug 17 23:24:09 2021
Library path: /home/roy/miniconda3/envs/r-4.1/lib/R/library
Repositories set.
R_MAX_NUM_DLLS set to 1000.
* installing *source* package ‘ragg’ ...
** package ‘ragg’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu
Using PKG_LIBS=-lfreetype -lpng16 -lm -lz -lm -lz -ltiff -lwebp -lzstd -llzma -ljbig -ljpeg -lz -lm
-----------------------------[ ANTICONF ]-------------------------------
Configuration failed to find one of freetype2 libpng libtiff-4. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
If freetype2 libpng libtiff-4 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4.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 MESSAGE] ---------------------------
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,
from /usr/include/libpng16/pngconf.h:31,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
| ^
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
from /usr/include/libpng16/pngconf.h:46,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
228 | #if __GLIBC_USE (DEPRECATED_GETS)
| ^
--------------------------------------------------------------------
ERROR: configuration failed for package ‘ragg’
* removing ‘/home/roy/miniconda3/envs/r-4.1/lib/R/library/ragg’
The downloaded source packages are in
‘/tmp/RtmpL1ZZnL/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("ragg") :
installation of package ‘ragg’ had non-zero exit status
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os Ubuntu 20.04.2 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en_GB:en
#> collate en_GB.UTF-8
#> ctype en_GB.UTF-8
#> tz Europe/Stockholm
#> date 2021-08-17
This issue happens in a conda environment. The suggested linux libraries are installed (see below, run in the same conda env).
sudo apt-get install -y libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libjpeg-dev is already the newest version (8c-2ubuntu8).
libpng-dev is already the newest version (1.6.37-2).
libfreetype6-dev is already the newest version (2.10.1-2ubuntu0.1).
libtiff5-dev is already the newest version (4.1.0+git191117-2ubuntu0.20.04.1).
0 to upgrade, 0 to newly install, 0 to remove and 26 not to upgrade.
ragg installation outside the conda env works fine. My guess is that when installing from the conda env, it doesn't find the path to something. Any tips?
It looks like something connected to this question answer. I encountered the same issue when was trying to install "ragg" package inside my conda env, and the suggested fix in the log (mentioned by #BlackBear answer) is not the real cause of the issue, the issue's cause is showed below in the log:
-------------------------- [ERROR MESSAGE] ---------------------------
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/limits.h:27,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:194,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/syslimits.h:7,
from /home/roy/miniconda3/envs/r-4.1/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed/limits.h:34,
from /usr/include/libpng16/pngconf.h:31,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
| ^
In file included from /home/roy/miniconda3/envs/r-4.1/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
from /usr/include/libpng16/pngconf.h:46,
from /usr/include/libpng16/png.h:339,
from <stdin>:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
228 | #if __GLIBC_USE (DEPRECATED_GETS)
| ^
--------------------------------------------------------------------
And it is maybe somehow connected to macros definition confusing. I'm not a big specialist in glibc and other things, for me the suggestion from the #MrFlick in comments to the question to install package directly via conda worked (mamba install -c conda-forge r-ragg)
The solution is in the log:
Configuration failed to find one of freetype2 libpng libtiff-4. Try installing:
* deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
* rpm: freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel (Fedora, CentOS, RHEL)
* csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
Install those packages and try again.
I saw the same error. The fix is to install pkg-config to the conda environment:
conda install -c conda-forge pkg-config
Somehow it seems that R c compiler under conda environment can not call system pkg-config correctly.

Installing R dependencies in Linux Mint

install.packages('xml2')
For example, if I try to install the above package, I get this error message:
------------------------- 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=...'
--------------------------------------------------------------------
I think I need to fix the path. How do I do that? I have the latest version of Linux Mint.
You have two basic choices:
First, you follow the advice of the error message you quoted and do
sudo apt install libxml2-dev
as your distribution is in fact a Debian/Ubuntu derivative.
Second, you could just install the existing binary from the distro
sudo apt install r-cran-xml2
Also, the r-sig-debian list is a good place to lurk and learn and ask questions.

i am unable to install rvest package in rstudio

so i want to install rvest package in my rstudio but wasn't able to as it said to install some packages on my system first ,i used this -->
sudo apt-get install libssl-dev
this got executed but after this also the error was -->
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.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=...'
--------------------------------------------------------------------
and
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl#1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.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=...'
--------------------------------------------------------------------
so i tried installing then using -->
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
but these are not working the error is -->
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev libssh2-1-dev libssl-dev
The following NEW packages will be installed:
libcurl4-openssl-dev
0 upgraded, 1 newly installed, 0 to remove and 31 not upgraded.
Need to get 318 kB of archives.
After this operation, 1,508 kB of additional disk space will be used.
Ign:1 http://in.archive.ubuntu.com/ubuntu disco-updates/main amd64 libcurl4-openssl-dev amd64 7.64.0-2ubuntu1.2
Err:1 http://security.ubuntu.com/ubuntu disco-updates/main amd64 libcurl4-openssl-dev amd64 7.64.0-2ubuntu1.2
404 Not Found [IP: 2403:8940:ffff::f 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/libcurl4-openssl-dev_7.64.0-2ubuntu1.2_amd64.deb 404 Not Found [IP: 2403:8940:ffff::f 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
then i tried using both of these too -->
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev --fix-missing
how can this problem be solved ?
You simply have a networking problem. It failed to connect to security,ubuntu.com.
Also not that a number of key packages are already in the distro so just do
sudo apt install r-cran-rvest
which works for me on 19.10 and may well too for you on 19.04 (which you should upgrade from).

Unable to install plotly and devtools in rstudio server installed in Ubuntu on AWS?

I have created an EC2 instance in AWS(with Ubuntu), installed r studio server, but when I am trying to install the plotly package it gives an error related to OpenSSL:
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your PATH
and PKG_CONFIG_PATH contains a libcurl.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=...'
------------------------------------------------------------‌-------
Also, I have tried to install devtools but no luck. Please help as this is the only part where I am stuck?
Thanks!
As the error message tells you, you need to install (the development files for) libcurl:
sudo apt-get install libcurl4-openssl-dev
There might be more such error messages down the road.
An interesting alternative to manual installation is to use binary packages, since their dependencies are handled automatically. See http://dirk.eddelbuettel.com/blog/2017/12/22/#014_finding_binary_deb_packages for details.
In Ubuntu 18.04 and later open the terminal and type:
sudo apt install r-cran-plotly
In earlier Ubuntu releases than Ubuntu 18.04 plotly can be installed with the following commands:
sudo R -e "install.packages('ggplot2', repos = 'http://cran.us.r-project.org')"
sudo R -e "install.packages('plotly', repos = 'http://cran.us.r-project.org')"

Resources