Installing package "chron" in R - r

Running Ubuntu 14.04 and while installing the package chron on R, I get the following message:
* installing *source* package ‘chron’ ...
** package ‘chron’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c chron_strs.c -o chron_strs.o
gcc: error trying to exec 'cc1': execvp: No such file or directory
make: *** [chron_strs.o] Error 1
ERROR: compilation failed for package ‘chron’
* removing ‘/home/ncoupe/R/x86_64-pc-linux-gnu-library/3.2/chron’
The downloaded source packages are in
‘/tmp/Rtmp1v7Xja/downloaded_packages’
Warning message:
In install.packages("chron") :
installation of package ‘chron’ had non-zero exit status
Any suggestions
Thanks
Natalia

chron has several non R dependencies. The easiest way to install it is
sudo apt-get update
sudo apt-get install r-cran-chron

Related

fatal error installing systemfonts in jupyter R docker

I am running jupyterlabs on docker and wanted to install the rvg package. One of the dependencies are systemfonts, and when I tried to install this using install.packages("systemfonts") I get:
Warning: unable to access index for repository https://cran.yu.ac.kr/src/contrib:
cannot open URL 'https://cran.yu.ac.kr/src/contrib/PACKAGES'
Warning message:
package ‘systemfonts’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
So I downloaded the tar.gz file from CRAN and installed from file, but I get a fatal error:
> install.packages("systemfonts_1.0.2.tar.gz", repo = NULL, type = "source")
* installing *source* package ‘systemfonts’ ...
** package ‘systemfonts’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lfontconfig -lfreetype
** libs
rm -f systemfonts.so caches.o cpp11.o dev_metrics.o font_matching.o font_registry.o ft_cache.o string_shape.o font_metrics.o font_fallback.o string_metrics.o emoji.o cache_store.o init.o unix/FontManagerLinux.o
x86_64-conda-linux-gnu-c++ -std=gnu++11 -I"/opt/conda/lib/R/include" -DNDEBUG -I'/opt/conda/lib/R/library/cpp11/include' -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include -I/opt/conda/include -Wl,-rpath-link,/opt/conda/lib -fpic -fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1607284869564/work=/usr/local/src/conda/r-base-4.0.3 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -c caches.cpp -o caches.o
In file included from caches.h:7,
from caches.cpp:1:
ft_cache.h:9:10: fatal error: ft2build.h: No such file or directory
9 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [/opt/conda/lib/R/etc/Makeconf:181: caches.o] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/opt/conda/lib/R/library/systemfonts’
Warning message:
In install.packages("work/corehead_data/systemfonts_1.0.2.tar.gz", :
installation of package ‘work/corehead_data/systemfonts_1.0.2.tar.gz’ had non-zero exit status
I tried to follow this SO Post, by typing in sudo apt-get install -y libfreetype6 to get freetype, but it is already the newest version. I'm not sure what else to try, hopefully someone can provide some expertise. Thanks.
Searching for "ft2build.h: No such file or directory Ubuntu" leads to this issue on systemfonts library GitHub where a workaround for the compilation error for Ubuntu 20.04 is shown:
sudo apt-get update
sudo apt-get install libfontconfig1-dev
This should help you to compile library from the tar.gz source.

How to install odbc package to Databricks cluster?

I need to access an Azure SQL Database from an R notebook in Databricks. To do this I aimed to use the odbc package, which installed fine on my local instance of R.
I have tried to install the package to the cluster using Databricks' interface, which always fails. I have also tried the following code within a notebook:
install.packages("odbc")
which results in:
Installing package into ‘/databricks/spark/R/lib’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/odbc_1.1.6.tar.gz'
Content type 'application/x-gzip' length 288033 bytes (281 KB)
==================================================
downloaded 281 KB
* installing *source* package ‘odbc’ ...
** package ‘odbc’ successfully unpacked and MD5 sums checked
PKG_CFLAGS=
PKG_LIBS=-lodbc
<stdin>:1:17: fatal error: sql.h: No such file or directory
compilation terminated.
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because odbc was not found. Try installing:
* deb: unixodbc-dev (Debian, Ubuntu, etc)
* rpm: unixODBC-devel (Fedora, CentOS, RHEL)
* csw: unixodbc_dev (Solaris)
* brew: unixodbc (Mac OSX)
To use a custom odbc set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘odbc’
* removing ‘/databricks/spark/R/lib/odbc’
The downloaded source packages are in
‘/tmp/RtmpqHp2QM/downloaded_packages’
I have also tried installing from github:
library(devtools)
devtools::install_github("r-dbi/odbc")
Which gives a different error:
Downloading GitHub repo r-dbi/odbc#master
Installing 3 packages: assertthat, BH, Rcpp
Installing packages into ‘/databricks/spark/R/lib’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/assertthat_0.2.1.tar.gz'
Content type 'application/x-gzip' length 12742 bytes (12 KB)
==================================================
downloaded 12 KB
trying URL 'https://cloud.r-project.org/src/contrib/BH_1.69.0-1.tar.gz'
Content type 'application/x-gzip' length 12378154 bytes (11.8 MB)
==================================================
downloaded 11.8 MB
trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_1.0.1.tar.gz'
Content type 'application/x-gzip' length 3661123 bytes (3.5 MB)
==================================================
downloaded 3.5 MB
* installing *source* package ‘assertthat’ ...
** package ‘assertthat’ successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (assertthat)
* installing *source* package ‘BH’ ...
** package ‘BH’ successfully unpacked and MD5 sums checked
** inst
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (BH)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Date.cpp -o Date.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Module.cpp -o Module.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rcpp_init.cpp -o Rcpp_init.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c api.cpp -o api.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c attributes.cpp -o attributes.o
g++ -I/usr/share/R/include -DNDEBUG -I../inst/include/ -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c barrier.cpp -o barrier.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -L/usr/lib/R/lib -lR
installing to /databricks/spark/R/lib/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (Rcpp)
The downloaded source packages are in
‘/tmp/RtmpqHp2QM/downloaded_packages’
Error in processx::run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), :
System command error
In addition: Warning messages:
1: In install.packages("odbc") :
installation of package ‘odbc’ had non-zero exit status
2: In install.packages("odbc") :
installation of package ‘odbc’ had non-zero exit status
Any idea why this package will not install on Databricks when it works fine locally and when all other packages I have tried install on Databricks work fine using the same syntax?
Best option to access a SQL Database is using the preinstalled JDBC connectivity (see the Documentation).
If you want to use ODBC this requires (as mentioned in one of the comments) unix odbc. Good practice to install multiple packages is using init-scripts. Following python code is for creating an init-script for pyodbc installation.
script = """
sudo apt-get -q -y install unixodbc unixodbc-dev
sudo apt-get -q -y install python3-dev
sudo pip install pyodbc
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
sudo curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql
"""
dbutils.fs.put("/databricks/init/pyodbc/pyodbc.sh", script, True)
Hope this helps.

RStudio AWS EC2 error when installing packages dependent on gsl

I set up an AWS EC2 instance of RStudio using the AMI provided by Louis Aslett.
However, when i try to install the package "topicsmodels" or "gsl" i get the following errors:
> install.packages("gsl")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/gsl_1.9-10.3.tar.gz'
Content type 'application/x-gzip' length 172529 bytes (168 KB)
==================================================
downloaded 168 KB
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpBItbU2/downloaded_packages’
and
> install.packages("topicmodels")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/topicmodels_0.2-6.tar.gz'
Content type 'application/x-gzip' length 712766 bytes (696 KB)
==================================================
downloaded 696 KB
* installing *source* package ‘topicmodels’ ...
** package ‘topicmodels’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cokus.c -o cokus.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c common.c -o common.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ctm.c -o ctm.o
ctm.c:29:25: fatal error: gsl/gsl_rng.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'ctm.o' failed
make: *** [ctm.o] Error 1
ERROR: compilation failed for package ‘topicmodels’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/topicmodels’
Warning in install.packages :
installation of package ‘topicmodels’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpBItbU2/downloaded_packages’
My knowledge of linux and RStudio server edition is fairly limited. I've tried following some intsructions from others who've experienced a similar problem, but none have worked (or i am unable to follow the instructions).
After googling a while this did work for me:
In Ubuntu to get topicmodels to install I needed to make sure that both:
GNU Scientific Library(GSL) -- binary package
GNU Scientific Library(GSL) -- development pacakage
were installed.

installation package "tm" fails

I am trying to install package "tm" and get an error (see below). From this error I can't see what is going wrong. Package Rcpp is installed. Working on R 3.4.0, Xubuntu 64.
How can I install package tm?
* installing *source* package ‘tm’ ...
** package ‘tm’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/home/henk/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/henk/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
In file included from /home/henk/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include/Rcpp.h:34:0,
from RcppExports.cpp:4:
/home/henk/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include/Rcpp/grow.h:73:47: fatal error: Rcpp/generated/grow__pairlist.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'RcppExports.o' failed
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘tm’
* removing ‘/home/henk/R/x86_64-pc-linux-gnu-library/3.4/tm’
Warning in install.packages :
installation of package 'tm' had non-zero exit status
The downloaded source packages are in
'/tmp/Rtmp3tKSat/downloaded_packages'
At first we can install "devtools" packages and than install "tm"
by using devtools::install_cran("tm")
try
sudo apt-get install r-cran-rcpp

Error in installing H2O ai R package in BigInsights cluster in Bluemix

I have a 5 node BigInsights hadoop cluster in Bluemix. I am getting error, when I am trying to install H2O ai R in BigInsights cluster.
install.packages("h2o", type="source", repos=(c("http://h2o-release.s3.amazonaws.com/h2o/rel-turing/3/R")))
ERROR: dependencies ‘statmod’, ‘RCurl’, ‘jsonlite’ are not available for package ‘h2o’
* removing ‘/home/opus/R/x86_64-redhat-linux-gnu-library/3.3/h2o’
The downloaded source packages are in
‘/tmp/RtmpJmcuyB/downloaded_packages’
Warning message:
In install.packages("h2o", type = "source", repos = (c("http://h2o-release.s3.amazonaws.com/h2o/rel-turing/3/R"))) :
installation of package ‘h2o’ had non-zero exit status
When I try to install 'RCurl' package of R in BigInsights cluster, getting the error message as:
trying URL 'https://cran.fhcrc.org/src/contrib/RCurl_1.95-4.8.tar.gz'
Content type 'application/x-gzip' length 916934 bytes (895 KB)
==================================================
downloaded 895 KB
* installing *source* package ‘bitops’ ...
** package ‘bitops’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c bit-ops.c -o bit-ops.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c cksum.c -o cksum.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o bitops.so bit-ops.o cksum.o -L/usr/lib64/R/lib -lR
installing to /home/opus/R/x86_64-redhat-linux-gnu-library/3.3/bitops/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘bitops’
finding HTML links ... done
bitAnd html
bitFlip html
bitShiftL html
cksum html
** building package indices
** testing if installed package can be loaded
* DONE (bitops)
* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/opus/R/x86_64-redhat-linux-gnu-library/3.3/RCurl’
The downloaded source packages are in
‘/tmp/RtmpJmcuyB/downloaded_packages’
Warning message:
In install.packages("RCurl") :
installation of package ‘RCurl’ had non-zero exit status
Please help me to resolve the issue and help would be much appreciated.
It looks like you are trying to install on Linux.
You need to install the development files for libcurl first.
eg
apt-get install libcurl4-openssl-dev
or
yum install libcurl-devel

Resources