Errors when installing specific R packages - r

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.

Related

Error when installing package ‘openNLPmodels.en’ in R / RStudio. Error: cannot open URL 'http://datacube.wu.ac.at/src/contrib/PACKAGES.rds'

When I try to install package ‘openNLPmodels.en’ in RStudio I get the following error messages:
I run the latest versions of RStudio an R. openNLP and openNLPdata are correctly installed. Can you help me to install the package? Thank you very much in advance.
install.packages("openNLPmodels.en", dependencies=TRUE, repos =
"http://datacube.wu.ac.at/", type = "source", INSTALL_opts = c('--no-lock'))
Warning in install.packages :
cannot open URL 'http://datacube.wu.ac.at/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
trying URL 'http://datacube.wu.ac.at/src/contrib/openNLPmodels.en_1.5-1.tar.gz'
Content type 'application/x-gzip' length 77794529 bytes (74.2 MB)
downloaded 74.2 MB
'\\WWG00M.ROOTDOM.NET\DFS\HOME\wt2rrib'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
ERROR: unable to create '\\Wwg00m.rootdom.net/dfs/HOME/WT2RRIB/R/Sentimental Analysis/openNLPmodels.en'
In R CMD INSTALL
Warning in install.packages :
installation of package ‘openNLPmodels.en’ had non-zero exit status
The problem is not installing openNLP. The problem is about manually installing the accompanying corpus in the language of your choice. Here are the options for the different languages in https://datacube.wu.ac.at/src/contrib/
openNLPmodels.da_1.5-2.tar.gz
openNLPmodels.de_1.5-2.tar.gz
openNLPmodels.en_1.5-1.tar.gz
openNLPmodels.es_1.5-1.tar.gz
openNLPmodels.it_1.5-1.tar.gz
openNLPmodels.nl_1.5-2.tar.gz
openNLPmodels.pt_1.5-2.tar.gz
openNLPmodels.sv_1.5-2.tar.gz
In your question, you are choosing English, so download the following onto your localhost: https://datacube.wu.ac.at/src/contrib/openNLPmodels.en_1.5-1.tar.gz
Manually install it into RStudio by selecting the tar.gz option:
Now you've got the English corpus installed for text mining with openNLP.

Sentiment Analysis using R: github 'okugami79/sentiment140' package installation error

I wish to install sentiment140 github package by developer okugami79. I wrote following script for the same:
install.packages("githubinstall")
require(devtools)
library(githubinstall)
install_github('sentiment140', 'okugami79')
library(sentiment)
But it threw an error:
Installation failed: Failed to connect to raw.githubusercontent.com port 443: Timed out
Warning message: Username parameter is deprecated. Please use okugami79/sentiment140
Then I modified installation statement as follows:
install_github('okugami79/sentiment140')
Still it threw an error:
Installation failed: Failed to connect to raw.githubusercontent.com port 443: Timed out
I checked for solution on stackoverflow through following link:
Timeout R package installation from Github
Here, I found a way to install github package by downloading package zip file and installing it in R using:
install.packages("/address/to/zip-package", repos = NULL, type="source")
This also prompts error:
Warning: invalid package 'sentiment-master'
Error: ERROR: no packages specified
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\u257449\Documents\R\win-library\3.3" "sentiment-master"' had status 1
Warning in install.packages : installation of package ‘sentiment-master’ had non-zero exit status
How should I go about installing required package from github in R ? Your valuable advice/solution is requested.
Thank You !
Just a straightforward pair of functions installed this package from Github source for me on both Windows and OSX.
install.packages("devtools")
devtools::install_github('okugami79/sentiment140')
There may be something unusual about your system setup, in which case, it would be helpful to have your session information. You can get that by entering sessionInfo().
However, note that this package you are looking to install is over 4 years old per the description file on Github. A lot of work has gone into other packages that work with natural language processing and sentiment analysis. The CRAN Task View for Natural Language Processing is a good place to start for an overview of many of these packages that can be installed directly from CRAN. There are many resources that are better maintained. For example, here's a chapter on sentiment analysis using the tidytext package.

Error installing packages in Rstudio

I have R 3.2.2 setup installed in my system,with RStudio version 0.99.489. When I tried to install rJava package,
install.packages("rJava")
I am getting following Error:
Warning in install.packages :
downloaded length 4878 != reported length 200
Error in install.packages : subscript out of bounds
But if I run the below command before installing any package,it works fine, but I don't want to do this every time I install a package.
options(repos=structure(c(CRAN="http://cran.us.r-project.org")))
You can stick the line you want executed at every startup in your .Rprofile file which should be in your home directory. I have 3.2.3 version of R and that worked; however I do get a warning message about using a non-http version of the site.
Similarly to you, I was finding the original repository the system was using was failing to install the packages--not finding the package or downloading a file with too few bytes, perhaps because of a transient problem. You might want to consider not putting this in your .Rprofile file or commenting the line outin case this is a temporary workaround.

Error when installing R package using Rstudio

I want to install http://cran.r-project.org/src/contrib/Archive/mecdf/ using RStudio but when I use
> install.packages('C:\\Users\\jandre\\Desktop\\mecdf_0.6.1.tar.gz', repos=NULL, type="source")
I get this error:
Installing package into ‘C:/Users/jandre/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"C:/Program Files/R/R-3.1.1/bin/x64/R" CMD INSTALL -l "C:\Users\jandre\Documents\R\win-library\3.1" "C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz’ had non-zero exit status
This occurs in every package I want to install using the tar.gz file. I'm on Win7 x64. RStudio Version 0.98.1028
Can't think of a way to fix this at the moment -- sorry -- but the R administration manual says explicitly:
Note that installing R into a directory whose path contains spaces is not supported, and at least some aspects (such as installing source packages) will not work.
I don't know why this doesn't bite people much more often, given that C:/Program Files/... seems like a relatively normal place to install things on Windows.
I would also expect that the double quotation marks around your R executable name ("C:/Program Files/R/R-3.1.1/bin/x64/R") in the system call should have protected you from this problem ... ?
I had the same error message with the installation of some packages(under Windows 10 OS with R and Rstudio).
It seems that the R software (not R Studio) is dealing with the library where package are installed.
I uninstalled R and Rstudio and installed it a path without space (ex: C:\Program\R).I tried to load the packages that previously failed and it seemed to fix the problem.

Error installing RMySQL

It took a good amount of time to install RMySQL on my Linux machine but I was able to install it after changing environment variables and copy and paste lib.dll file.
However, I'm now trying to install RMySQL on my 64bit window machine, but so far there's no progress yet for two days. It broke down after "running command sh ./configure.win had status 127 error, and I cannot find what this means.
Can anyone shed some lights on this?
install.packages('RMySQL',type='source')
Installing package into ‘C:/Users/chu/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/RMySQL_0.9-3.tar.gz'
Content type 'application/x-gzip' length 165363 bytes (161 Kb)
opened URL
downloaded 161 Kb
* installing *source* package 'RMySQL' ...
** package 'RMySQL' successfully unpacked and MD5 sums checked
Warning: running command 'sh ./configure.win' had status 127
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/Users/chu/Documents/R/win-library/3.1/RMySQL'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" CMD INSTALL -l "C:\Users\chu\Documents\R\win-library\3.1" C:\Users\chu\AppData\Local\Temp\RtmpKA9e7I/downloaded_packages/RMySQL_0.9-3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\chu\AppData\Local\Temp\RtmpKA9e7I\downloaded_packages’
for linux users..
install- libmysql first
sudo apt-get install libmysql++-dev
then try.
I was facing the same error. Given below is the link to a way around that worked for me.
http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/
In short, the location of library libmysqll.dll required for compilation, had to be changed from lib folder to bin folder of the home directory set for MySQL in environment variables.
By default, R uses the /tmp directory to install packages. On security conscious machines, the /tmp directory is often marked as “noexec” in the /etc/fstab file. This means that no file under /tmp can ever be executed. Packages that require compilation or that have self-inflating data will fail with the error mentioned.
The solution is to set the TMPDIR environment variable outside R (in your shell), which R will use as the compilation directory. How to do this depends on the shell. bash:
mkdir ~/tmp
export TMPDIR=~/tmp
Then R can compile and install the package.
I ran into the same problem while updating packages on Windows server for latest version of R. I solved it by installing from a .zip file vs .tar.gz.
I actually had to go through the process of first downloading the package, and then installing from it (not from mirror) for other reasons.
Here is what it looked like:
pk <- 'caTools'
download.packages(pk, "R-3.2-packages/" ,type = "win.binary")
install.packages(
dir("R-3.2-packages/",pattern=pk,full.names = TRUE),
repos = NULL,
type = "source")
Hope this helps.
Solution if anyone faced the same problem on windows:
Make sure your MYSQL_HOME environment variable is set correctly and libmysql.dll is copied to bin folder!!!
Run install.packages('RMySQL') then when the "Do you want to install from sources..." window pops up select No.
Then copy the downloaded binary packages location from console.
Go to Packages -> Install, paste the location into Package archive and click Install.

Resources