openNLP on a mac - r

I am not familiar with Mac (I use Windows and Linux Mint) but have a package that I need to be able to tell people on all platforms how to build. This package relies on openNLP and because of encoding issues with the MacOS X does not install via install.packages("openNLP").
I have had people tell me you can still install using install.packages("openNLP", type="source") but I get the following message:
> install.packages("openNLP", type="source")
trying URL 'http://cran.rstudio.com/src/contrib/openNLP_0.0-8.tar.gz'
Content type 'application/x-gzip' length 807784 bytes (788 Kb)
opened URL
==================================================
downloaded 788 Kb
* installing *source* package ‘openNLP’ ...
/Library/Frameworks/R.framework/Resources/bin/config: line 142: make:
command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 143: make:
command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 219: make:
command not found
Could not determine the Java interpreter.
Maybe run R CMD javareconf?
ERROR: configuration failed for package ‘openNLP’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/openNLP’
The downloaded source packages are in
‘/private/var/folders/YW/YWal638NEwi-tFse3NsBFk+++TM/-Tmp-/RtmpaWdKnC/downloaded_packages’
Warning message:
In install.packages("openNLP", type = "source") :
installation of package ‘openNLP’ had non-zero exit status
So I use Mac''s temrinal to do the suggested R CMD javareconf:
Java interpreter : /usr/bin/java
Java version : 1.6.0_37
Java home path :
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path:
JNI linker flags : -framework JavaVM
JNI cpp flags : -I$(JAVA_HOME)/include
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
And try closing out R, re-opening and then install.packages("openNLP", type="source") but the same message occurs. Google has not helped me here and I am very unfamiliar with Mac. I assume it has to do with the type of java installed but know too little about Mac to play aimlessly as this is not my Mac machine.
Please direct me with getting openNLP to install correctly.

I just compiled from source on Mas OSX 10.6.8 with R 2.15.2 with no error. Given the fact that the error message says make cannot be found, it sounds as though that machine is not yet set up to compile from source. Do you understand that XCode is not installed by default and that you need to acquire it from Apple in order to compile "source" packages?

Related

installation of package ‘rmarkdown’ had non-zero exit status - How to solve that?

I am trying to install ‘rmarkdown’ in my RStudio Version 1.4.904 and R version 4.0.3 but getting the following error. I cannot open a new rmarkdown and knit a rmarkdown file. Every time I try, this message pops up,
R Markdown documents requires an updated version of the rmarkdown package. Do you want to install this package now?
Can anyone help me with that?
install.packages(ç, dependencies=TRUE)
Installing package into ‘/Users/Library/R/4.0/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
rmarkdown 2.3 2.4 FALSE
installing the source package ‘rmarkdown’
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rmarkdown_2.4.tar.gz'
Content type 'application/x-gzip' length 3202546 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
Warning in file(con, "r") :
cannot open file '/var/db/timezone/zoneinfo/+VERSION': No such file or directory
dyld: lazy symbol binding failed: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
/Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 30112 Done echo 'tools:::.install_packages()'
30113 Abort trap: 6 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args}
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/70/lgr12kdn6wn_k36sscnc0_dw0000gn/T/Rtmpmc0jUR/downloaded_packages’```
download the binary tgz (https://cran.r-project.org/web/packages/rmarkdown/index.html) and install directly from it.
It should work. I had pretty much the same issue and I solved it that way. Keep me posted!
F
I also faced a similar problem and I spent a half-day on getting the correct solution.
Step I followed:
Uninstalled the existing version
Installed updated version of R - R version 4.0.4 (2021-02-15).
Clicked on File->New file->R markdown. It asked to install Rmarkdown packages.
Noted the packages I need to install
Typed install.packages("rmarkdown", dependencies = TRUE) on R source(can be done on R console)
Then I tried installing Rmarkdown packages individually and it worked for me. Below are the packages I needed to install.
install.packages('knitr')
install.packages('tinytex')
install.packages('base64enc')
install.packages('digest')
install.packages('jsonlite')
install.packages('htmltools')
install.packages('rmarkdown')
A somewhat more technical workaround but it worked for me.
Go to https://cran.r-project.org/ select "Packages" from the menu on the right and navigate until you find the package you need.
Download the binary.zip file for your operating system and extract the files.
Copy the extracted folder into the installation directory for your packages. It should be shown somewhere in the error messages from where you attempted to install the package originally. Replace any existing files. Restart RStudio to recognize the updated versions.

Errors when installing specific R packages

I am receiving error messages when I try to install specific packages in R. The packages in question are pillar and osrm. I recently updated several packages without any problems so I'm not sure why these ones are causing an issue.
The error message I recieve when installing either of the two packages is as follows:
There is a binary version available but the source version is later:
binary source needs_compilation
osrm 3.2.0 3.3.1 FALSE
installing the source package ‘osrm’
trying URL 'https://cran.rstudio.com/src/contrib/osrm_3.3.1.tar.gz'
Content type 'application/x-gzip' length 119746 bytes (116 KB)
downloaded 116 KB
'\\CompanyX\ProgData\R_Studio\R-34~1.1' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"X:/R_Studio/R-34~1.1/bin/i386/R" CMD INSTALL -l "X:\R_Studio\R-3.4.1\library" C:\Users\abc123\AppData\Local\Temp\RtmpKk0RxD/downloaded_packages/osrm_3.3.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘osrm’ had non-zero exit status
I have seen in other posts that the binary/source issue is caused by recent updates to the package and this requires a compiler. As I am on a company machine, I am unable to easily install RTools. I have also installing tried older versions of each package - this results in the same error.
I have tried to download from Github directly via devtools::install_github("rCarto/osrm") but I always get the following error:
Installation failed: Failed to connect to raw.githubusercontent.com port 443: Timed out
I'm not sure if this is due to a company firewall blocking the access, but it seems to occur with any package I try to download from GitHub.
Finally, I have tried to install directly from the tar.gz file or a zip file downloaded from CRAN/GitHub. The former results in the following error:
'\\CompanyX\ProgData\R_Studio\R-34~1.1' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"X:/R_Studio/R-34~1.1/bin/i386/R" CMD INSTALL -l "X:\R_Studio\R-3.4.1\library" "C:/Users/abc123/AppData/Local/Temp/RtmpKk0RxD/downloaded_packages/osrm_3.3.1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/abc123/AppData/Local/Temp/RtmpKk0RxD/downloaded_packages/osrm_3.3.1.tar.gz’ had non-zero exit status
While the zip file route does place the package folder in the R root library folder but then results in a system error requesting the latest version of R and then crashes RStudio completely.
Any advice as to either successfully install these packages or a specific issue I could raise with the company IT department would be much appreciated.

Error in installing car package in R

While installing "car" package in Rstudio in Ubuntu, I faced an error saying that dependencies "nloptr","lme4" and one more, are not installed.
So I started installing "nloptr" but I faced this error-
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-
2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to
/tmp/RtmpSeLv7g/R.INSTALL18a67910d582/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
System hangs after last line and when I restart after some time, "nloptr" is not installed and hence I am unable to install "car" package.
Please help me. Thanks in advance.
I was encountering the same problem under R (pure R 3.2.3 on Linux Debian). I was first blocked by another issue during the same installation : the installation process failed to lock directory ~/.../R/x86_64.../3.2 and suggested to remove ~/.../R/x86_64.../3.2/00LOCK-nloptr . I did it, restart the car package installation, and then it blocked at the same point: it needs nlopt.h.
So, I installed libnlopt-dev (sudo apt-get install libnlopt-dev) and re-restart the car installation ... and then it worked.
Ok, this is under linux, but perhaps should you try to focus on installing something about NLOPT under windows.
Good luck.

How to install R-packages not in the conda repositories?

I am using Anaconda to manage my R-installation. It works great for packages available in the R-channels provided by Anaconda, but I am having troubles installing packages not contained in the Anaconda repos.
I have tried a few different approaches, all listed below together with their error output.
1. install.packages('rafalib')
Suggested to work here conda - How to install R packages that are not available in "R-essentials"?. My .libPaths() points to '/home/user/anaconda2/lib/R/library'.
Out:
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.18/library ./tcl8.5.18/library
This probably means that Tcl wasn't installed properly.
I installed tcl from the conda channel r-old, but install.packages() still threw the same error message.
2. options(menu.graphics=FALSE) and then install.packages('rafalib')
I got a list of mirrors and chose one.
Out:
Selection: 15
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/Rtmphwpta0/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
Both 2 and 3 are from Disable/suppress tcltk popup for CRAN mirror selection in R
3. Setting the mirror in ~/.Rprofile
Before trying install.packages(), I added the following to my ~/.Rprofile.
## Default repo
local({r <- getOption("repos");
r["CRAN"] <- "http://cran.us.r-project.org";
options(repos=r)})
Out:
trying URL 'http://cran.us.r-project.org/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/RtmppIz9rT/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
4. Setting the download method to 'curl' or 'wget'.
While keeping the new ~/.Rprofile configuration. I guess this wasn't necessary since the package seems to be downloading fine now, but I tested it just in case.
Out:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
download of package ‘rafalib’ failed
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
download had nonzero exit status
5. Manual download of rafalib
install.packages('../Downloads/rafalib_1.0.0.tar.gz', repos=NULL, type='source')
Out:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning message:
In install.packages("../Downloads/rafalib_1.0.0.tar.gz", repos = NULL, :
installation of package ‘../Downloads/rafalib_1.0.0.tar.gz’ had non-zero exit status
6. Building a conda package from rafalib
I opened a separate issue for this Errors building R-packages for conda. In short, it complains about missing dependencies that I already have installed. Update I got a round the dependency problem and I am now stuck at the same rl_signal_event_hook-error as for my other approaches.
7. sudo ln /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5
As per https://github.com/conda/conda/issues/1679, but it didn't fix the issue for me.
So it seems like I can now download the package fine, but installing it fails. I have seen the error message sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook previously when using R with irkernel in the Jupyter Notebook, but it has never obstructed my work. I have never seen anything relating to that error message when running python through anaconda.
I'm out of ideas. Does anyone know how I can install R-packages not provided by anaconda, such as rafalib or swirl?
I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.
UPDATE 2016/04/15
There is some related discussion in this thread. I have tried to get around this error by installing different versions of ncurses, including this patched version, and I have tried to link the readline libraries, as suggested here, but I keep running into the same error. I'm quite lost at this point and any help to solve this would be greatly appreciated.
Detailed post on managing packages that are and are not in Anaconda R: http://ihrke.github.io/conda.html
Essentially is using commands:
conda skeleton cran <package_name>
conda build <package_name>
If the package has dependencies that are also not in Anaconda:
conda skeleton cran <dependency1>
conda skeleton cran <dependency2>
conda build <package_name>
Essentially I would agree with this post in saying that I don't understand how install.packages() works with Anaconda. What I seem to see is that Anaconda creates a R environment where all the packages installed from install.packages() are kept.
Whenever I am working in Jupyter with R, I use this environment and am able to access all the packages that I have installed with install.packages()
In the end, I got around the rl_event_hookproblems by following the approach recommended here and symlinking anaconda's libreadline to the system one:
mv ~/anaconda3/lib/libreadline.s.6.2 ~/anaconda3/lib/libreadline.s.6.2.bak
ln -s /usr/lib/libreadline.so.6.3 ~/anaconda3/lib/libreadline.s.6.2
I am still having troubles installing some dependency heavy R-packages due to failure to load shared objects when using install.packages() from withing R. However, simpler packages work fine and I can get most of the dependency heavy packages from anacondas R-repositories.

Installing packages from source fails with "unexpected $end" error

This one is killing me:
Problem: I can't install any packages in R from source code using standard repositories.
install.packages("quantreg", type="source")
Installing package into ‘/Users/foo/Library/R/3.0/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.wustl.edu/src/contrib/quantreg_5.05.tar.gz'
Content type 'application/x-gzip' length 1636075 bytes (1.6 Mb)
opened url
downloaded 1.6 Mb
Error: 1:5: unexpected $end
Execution halted
The downloaded source packages are in
‘/private/var/folders/h3/yfhgnv7n5gq84ly4kr6334gr0000gn/T/Rtmp3kothF/downloaded_packages’
Warning message:
In install.packages("quantreg", type = "source") :
options("unzip")
$unzip
[1] "internal"
Details
OS: OSX.9
I made a clean install of Mavericks and installed Xcode 5 + command line tools.
R: 3.0.2 installed from CRAN binary
I realize that I could install binary packages for "quantreg", but that's not the point.
Question: How can I fix this?
I've tried:
installing R from source (actually, this is how I first noticed the problem)
1b. installing R from source using clang and clang++
modifying /Library/Frameworks/R.framework/Versions/3.0/Resources/etc/Makeconf file to change CC and CXX to clang, clang++
Voodoo
Obviously, none of these things worked for me. Am I just doing something naively stupid? Use small words in simple sentences, please.
UPDATE:
Using the r-sig-mac archives, there was some stuff that was appropriate regarding the incredible, dissapearing GNUTAR. I also found on my own some problems with the gfortran call. I made some headway (but still not solved) by adding the following lines to my "/Users/foo/.R/Makevars" file
TAR=/usr/bin/tar
FC=/usr/local/bin/gfortran
F77=/usr/local/bin/gfortran
FLIBS = -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3
Note that this removes the "-lgfortran" option from FLIBS.
Now, the packages will install using R CMD INSTALL /path/to/source.tar.gz (which is new), but still won't work using my original command in R.

Resources