I am trying to install the package called topicmodels in R and I have not had success. Here's what I have tried...
Action:
Install the package using install.packages("topicmodels")
Result:
package ‘topicmodels’ is available as a source package but not as a binary
Warning in install.packages :
package ‘topicmodels’ is not available (for R version 3.1.0)
So there I said okay let's install from source
Action:
install.packages("/Users/my_name/Downloads/topicmodels_0.2-1.tar.gz",repos=NULL,type="source")
Result:
* installing *source* package ‘topicmodels’ ...
** package ‘topicmodels’ successfully unpacked and MD5 sums checked
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c cokus.c -o cokus.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c common.c -o common.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c ctm.c -o ctm.o
ctm.c:29:10: fatal error: 'gsl/gsl_rng.h' file not found
include gsl/gsl_rng.h
1 error generated.
make: *** [ctm.o] Error 1
ERROR: compilation failed for package ‘topicmodels’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/topicmodels’
Warning in install.packages :
installation of package ‘/Users/me/Downloads/topicmodels_0.2-1.tar.gz’ had non-zero exit status
So then I researched this gsl thing and came upon this link. And for the moment I thought all of my problems were gone and when I finally follow these directions. I get the following error (in the terminal)...
Warning in untar2(tarfile, files, list, exdir, restore_times) :
using pax extended headers
ERROR: cannot extract package from ‘topicmodels.tar.gz’
First of all you have to install gsl. Once you have that installed you can try to install the R package. You can download gsl from here (there you can pick the latest version gsl-latest.tar.gz). Once it's been downloaded, install it by doing the following:
Decompress the downloaded file (in my case the "latest" file contained this version: gsl-1.16)
Open the "Terminal"
Then (using the Terminal), move inside the folder that you created on step 1. In my case I had the file on the folder called "Downloads", so I moved to the newly created folder by doing:
cd Downloads/gsl-1.16
Once you are within that folder run the following commands (in order):
./configure
make
sudo make install
After doing it you won't get the previous error saying fatal error: 'gsl/gsl_rng.h' file not found, so you can try again the installation.
Now go back to your R environment (e.g., RStudio) to try again to install the package by doing:
install.packages("PATH_TO_TOPIC_MODELS.tar.gz", repos=NULL, type="source").
I had the same problem, and after doing this I got the R package correctly installed, I hope it also works in your case.
If you already using homebrew. It is better and faster to fix with variables than installing gsl manually from source.
Install gsl with homebrew brew install gsl
Edit ~/.R/Makevars and add.
PKG_LIBS=-L/usr/local/opt/gettext/lib
CFLAGS=-I/usr/local/opt/gsl/include
LDFLAGS=-L/usr/local/opt/gsl/lib -lgsl -lgslcblas
If you are using Linux based on Debian, that's my solution:
Using terminal run sudo apt install gsl-bin libgsl-dbg libgsl-dev libgsl25 libgslcblas0;
Then, using R console, run install.packages("topicmodels",dependencies =T);
Enjoy!!
Related
I am trying to install RcppMP in MacOS.
However, when I type:
remotes::install_github("Thell/RcppMP",dependencies = T)
I get the following error:
* installing *source* package ‘RcppMP’ ...
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/BH/include' -I'/Library/Frameworks/R.framework/Versions/4.1/Resources/library/Rcpp/include' -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/RcppMP.h:7:
In file included from ../inst/include/RcppMP_RcppExports.h:7:
../inst/include/RcppMP_types.hpp:15:10: fatal error: 'mpreal.h' file not found
#include <mpreal.h>
^~~~~~~~~~
1 error generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘RcppMP’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppMP’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/pq/hxwd9my563q_qpy4rbrlgkmw0000gn/T//RtmpIdnyiB/file2184610d74ea/RcppMP_0.1.1.tar.gz’ had non-zero exit status
My ~/.R/Makevars file contain the following specifications:
CC=/usr/local/opt/llvm/bin/clang
CXX=/usr/local/opt/llvm/bin/clang++
CXX1X=/usr/local/opt/llvm/bin/clang++
LDFLAGS=-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib
CXXFLAGS=-I/usr/local/opt/llvm/include
FLIBS=-L/usr/local/Cellar/gcc/11.3.0_1/lib/gcc/11
This was a bit more complicated than I thought; this package requires mpfr, gmp and the very-similarly-named mpfrc++. The steps that worked for me are:
Install gmp and mpfr via homebrew
Download and unzip "mpfrc++-3.6.8.zip" from
http://www.holoborodko.com/pavel/mpfr/#download
Copy the mpreal header file ("mpreal.h") to
/usr/local/include (sudo cp ./mpreal.h /usr/local/include/) or, in your case, perhaps sudo cp ./mpreal.h /usr/local/opt/llvm/include would make more sense
Install/compile RcppMP
(remotes::install_github("Thell/RcppMP",dependencies = TRUE))
I got some warnings but no errors, and the package loaded (library(RcppMP)), so I'm relatively confident it installed successfully. If you find otherwise, please let me know and I'll look into it further.
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.
I tried to install RcppEigen on amazon EC2 (on a t1.micro to
make sure It works) & ubuntu 13.04. I tried with both R version was 2.15.2 and 3.0, 32bit ubuntu and 64bit ubuntu. Any time I got the following:
root#ip-10-224-4-239:/home/ubuntu# R CMD INSTALL RcppEigen_0.3.1.2.1.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fpic -O2 -pipe -g -c RcppEigen.cpp -o RcppEigen.o
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fpic -O2 -pipe -g -c fastLm.cpp -o fastLm.o
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
make: *** [fastLm.o] Error 4
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/usr/local/lib/R/site-library/RcppEigen’
Anyone has an idea on how to get RcppEigen to run on EC2?
(Rcpp installs flawlessly....)
That looks like a "simple" out of memory issue.
C++ can be demanding as is, and complex template code (which Eigen surely is) demands even more resources. Simply try allocating more memory -- otherwise it is hard to kill g++.
I'm trying to install the venneuler R package on linux.
Running: install.packages("venneuler") gives this error:
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ârJavaâ
* removing â/home/nruns/R/rJavaâ
Warning in install.packages :
installation of package ârJavaâ had non-zero exit status
ERROR: dependency ârJavaâ is not available for package âvenneulerâ
* removing â/home/nruns/R/venneulerâ
Warning in install.packages :
installation of package âvenneulerâ had non-zero exit status
The downloaded source packages are in
â/tmp/RtmpjiRTHN/downloaded_packagesâ
Trying to install the rJava package produces the same error.
So I then run R CMD javareconf as suggested and get this error:
trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
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-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c conftest.c -o conftest.o
conftest.c:1:17: fatal error: jni.h: No such file or directory
#include <jni.h>
I updated java using:
sudo yum install java-1.8.0-openjdk
which completed fine but am still getting the same error trying to install venneuler
Any idea?
For rjava try installing following packages. It helped me
libbz2-dev
libpcre3-dev or libpcre2-dev
liblzma-dev
sudo apt-get install packagename
I am writing an R package that has Fortran source code. In short, my problem is when I try to install the package I get the error "gfortran -m32: not found" however, I am able compile my code using gfortran -m32 when I'm not installing the package.
Detailed Version:
I have installed the newest version of R(3.1.1) along with the newest version of Rtools(31) and renamed my path variables accordingly (C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Program Files\R\R-3.1.1\bin\x64;C:\msys;C:\Program Files (x86)\SSH Secure Shell;C:\Program Files\MiKTeX 2.9\miktex\bin).
For testing purposes, I downloaded the PropClust package from CRAN which has Fortran source code.
When I type "R CMD INSTALL PropClust_1.4.tar.gz" after building it, I get the following error:
* installing *source* package 'PropClust' ...
** libs
*** arch - i386
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:202: warning: overriding recipe for target `.m.o'
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:195: warning: ignoring old recipe for target `.m.o'
gfortran -m32 -O3 -mtune=core2 -c PropClustParallelTrials.f90 -o PropClustParallelTrials.o
gcc -m32 -I"C:/PROGRA~1/R/R-31~1.1/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O3 -Wall -std=gnu99 -mtune=core2 -c minWhichMin.c -o minWhichMin.o
gfortran -m32 -shared -s -static-libgcc -o PropClust.dll tmp.def PropClustParallelTrials.o minWhichMin.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.1/bin/i386 -lR
gfortran -m32: not found
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:202: warning: overriding recipe for target `.m.o'
C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf:195: warning: ignoring old recipe for target `.m.o'
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.1/bin/i386/Rterm.exe
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-31~1.1/bin/i386/Rterm.exe
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
no DLL was created
ERROR: compilation failed for package 'PropClust'
* removing 'C:/Users/kamicz/Documents/IsotopeR/PropClust.Rcheck/PropClust'
Although it says "gfortran -m32: not found" I have compiled my code in the same window with the same options(gfortran -m32 -O3 -mtne=core2 -c a.f90 -o a.out) with no problems. Has anyone had this problem before? I am running Windows 7 64-bit if that matters.
I had a similar problem : R was invoking gfortran-4.8 - an unrecognized command on my system - instead of gfortran. This problem was fixed upon creating the file ~/.R/Makevars within my home directory. Here are the contents of Makevars which points to the appropriate gfortran installation:
F77 = gfortran
FC = gfortran
FLIBS = -L/usr/local/gfortran/lib