Cannot build R package "png" Fedora 20 - r

I am trying to build the R package png, the repo says that libpng needs to be available.
I run a Linux Fedora 20 distro
Looks like I have it...
[root#localhost bin]# yum install libpng
Loaded plugins: langpacks, refresh-packagekit
Package 2:libpng-1.6.3-3.fc20.x86_64 already installed and latest version
Nothing to do
But when I try to install it:
> install.packages("png")
Installing package into ‘/home/statquant/R/x86_64-redhat-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 Kb)
opened URL
==================================================
downloaded 24 Kb
* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include `libpng-config --cflags` -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c read.c -o read.o
/bin/sh: libpng-config: command not found
read.c:3:17: fatal error: png.h: No such file or directory
#include <png.h>
^
compilation terminated.
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘png’
* removing ‘/home/statquant/R/x86_64-redhat-linux-gnu-library/3.0/png’
The downloaded source packages are in
‘/tmp/RtmpG5MjG9/downloaded_packages’
Warning message:
In install.packages("png") :
installation of package ‘png’ had non-zero exit status

For some R packages you need the corresponding development library to successfully install the R package. In your case this should do what you need
# Do the following in your terminal (not in an R session)
yum install libpng-devel
afterwards you should be able to install the R package
# Do the following in the R console (during an R session)
install.packages("png")

I had the same problem on Ubuntu (16.04) and solved it using
sudo apt-get install libpng-dev

Related

gcc-8: command not found (while installing randomForest)

I'm trying to install "randomForest" on R 3.6.3 as below:
urlPackage <- "https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-14.tar.gz"
install.packages(urlPackage, repos=NULL, type="source")
(install.packages('randomForest') throws the error: package 'randomForest' is not available (for R version 3.6.3))
The lines above, however, give me the following error:
trying URL 'https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-14.tar.gz'
Content type 'application/x-gzip' length 80074 bytes (78 KB)
==================================================
downloaded 78 KB
* installing *source* package ‘randomForest’ ...
** package ‘randomForest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -c classTree.c -o classTree.o
/bin/sh: gcc-8: command not found
make: *** [classTree.o] Error 127
ERROR: compilation failed for package ‘randomForest’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/randomForest’
Warning in install.packages :
installation of package ‘/var/folders/66/3s4r17rx7ln0b1p8tyrmws780000gn/T//RtmpDOHynP/downloaded_packages/randomForest_4.6-14.tar.gz’ had non-zero exit status
Does anyone have any idea how to solve this? I'm on macOS Catalina (ver 10.15.7)
You should install the gcc8 tool:
sudo port install gcc8
Related Links
MacPorts - GCC8
YouTube - Install GCC 8 with Homebrew on macOS

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.

Troubles Installing R Word Cloud Package - Mint 17.1

Attempting to install the R Word-Cloud Package into User Library, however receiving the following error. Looks like it successfully downloads package, but bombs during installation. I suspect the issue is resulting from trying to install in a User Library and the second g++ line, but not sure how to correct. I am running Mint 17.1 64-bit.
Any suggestions would be appreciated.
install.packages("wordcloud", lib="/media/Data/RPackages")
trying URL 'http://mirrors.nics.utk.edu/cran/src/contrib/wordcloud_2.5.tar.gz'
Content type 'application/x-gzip' length 40861 bytes (39 KB)
==================================================
downloaded 39 KB
.Rprofile: Setting CMU repositoryn
* installing *source* package ‘wordcloud’ ...
** package ‘wordcloud’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/media/Data/RPackages/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c layout.cpp -o layout.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o wordcloud.so layout.o .Rprofile: Setting CMU repositoryn -L/usr/lib/R/lib -lR
g++: error: .Rprofile:: No such file or directory
g++: error: Setting: No such file or directory
g++: error: CMU: No such file or directory
g++: error: repositoryn: No such file or directory
make: *** [wordcloud.so] Error 1**strong text**
ERROR: compilation failed for package ‘wordcloud’
* removing ‘/media/Data/RPackages/wordcloud’
Warning in install.packages :
installation of package ‘wordcloud’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpdScavH/downloaded_packages’
Figured out the issue. In my .Rprofile file, I had the following:
cat(".Rprofile: Setting CMU repositoryn")
r = getOption("repos") # hard code the Oakridge repo for CRAN
r["CRAN"] = "http://mirrors.nics.utk.edu/cran/"
options(repos = r)
rm(r)
I removed the first line changing it to the following:
r = getOption("repos") # hard code the Oakridge repo for CRAN
r["CRAN"] = "http://mirrors.nics.utk.edu/cran/"
options(repos = r)
rm(r)
Restarted R and install worked. I guess the WordCount package didn't like the first line.

Installing a cassandra package

I'm new to R and cassandra, I'm trying to install the rcassandra package. On the rforge.net site, it says to do:
> install.packages('RCassandra',,'http://www.rforge.net/')
Warning: unable to access index for repository http://www.rforge.net/src/contrib
Warning message:
package ‘RCassandra’ is not available (for R version 3.1.0)
Trying a different repository
> install.packages('RCassandra',repo='http://cran.cnr.Berkeley.edu/')
Installing package into ‘/home/as/R/x86_64-redhat-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository http://cran.cnr.Berkeley.edu/src/contrib/
Warning message:
package ‘RCassandra’ is not available (for R version 3.1.0)
I tried installing from command line, but that does'nt seem to work either:
> sudo R CMD INSTALL RCassandra_0.1\-3.tar.gz
* installing to library ‘/home/as/R/x86_64-redhat-linux-gnu-library/3.1’
* installing *source* package ‘RCassandra’ ...
** package ‘RCassandra’ 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 -c cass.c -o cass.o
cass.c:1: sorry, unimplemented: 64-bit mode not compiled in
make: *** [cass.o] Error 1
ERROR: compilation failed for package ‘RCassandra’
* removing ‘/home/as/R/x86_64-redhat-linux-gnu-library/3.1/RCassandra
So how do I install the package? I can see the package on the web sites

An error when install R package forecast on AWS instance

install.packages('forecast')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/forecast_5.4.tar.gz'
Content type 'application/x-gzip' length 150965 bytes (147 Kb)
opened URL
downloaded 147 Kb
installing source package ‘forecast’ ...
package ‘forecast’ successfully unpacked and MD5 sums checked
libs
g++ -m64 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/RcppArmadillo/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c calcBATS.cpp -o calcBATS.o
In file included from calcBATS.cpp:1:0:
calcBATS.h:36:27: fatal error: RcppArmadillo.h: No such file or directory
#include
^
compilation terminated.
make: * [calcBATS.o] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/usr/lib64/R/library/forecast’
The downloaded source packages are in
‘/tmp/RtmpJRX18M/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("forecast") :
installation of package ‘forecast’ had non-zero exit status
Looks like there is a missing package dependence, RcppArmadillo.
install.packages("RcppArmadillo")
Then:
install.packages('forecast')
add within your lifecycle configuration
conda install -y -c r r-forecast

Resources