configuration error when installing rJava package - r

During installing rJava package, I got the following error messages:
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’
May I know what is the cause for this failure and how to fix this issue? Thanks.

If it installed but does not work try first : remove.package("rJava") and the install.package("rJava"). Some times helps. If still ahvgin problem post more data. But unless it's not necessary.
EDIT : see also java path if it's correctly set up. Sometimes its messed up.

Related

"package or namespace load failed" error in loading R package from GitHub

I am trying to load a package in RStudio from GitHub but I get an error.
I have also updated all the packages in order to see if this was the problem but I still get the same error. I have a MAC pc (I don't know if this may cause some problems).
The link of the package that I would like to load is:
https://github.com/andrewraim/COMMultReg
and there is written that in order to load it I need to run
library(devtools)
install_github("andrewraim/COMMultReg")
But when I run the second line I get as error:
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘COMMultReg’ in namespaceExport(ns, exports):
undefined exports: d_cmb, d_cmb_sample, d_cmm, d_cmm_sample, gunterize, loglik_score_fim_cmm, normconst_cmb, normconst_cmm, r_cmb
Errore: loading failed
Esecuzione interrotta
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/COMMultReg’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/n0/4lmr1lrj7qqfylmh6s8qx0nr0000gn/T//RtmpldrmHr/file72e1e4469d/COMMultReg_0.1.0.tar.gz’ had non-zero exit status
Can somebody help me telling me what to do?
Thanks!!
The package has no function named d_cmb, but it tries to export that function. That's what the error message says, and it's true.
I think the reason for this error is that the author used Roxygen2 to generate his NAMESPACE file where the exports are declared, but that file is out of sync with the contents of the package.
It's possible this happened because the author forgot to commit a new file containing the new code. In that case, the best solution is to contact the author, and point out the issue.
Alternatively, it may have happened because at one time there was a d_cmb function, but the author removed it, without updating the NAMESPACE file. This one you might be able to fix yourself.
To fix this, you'll need to run Roxygen2 yourself, which is a little more complicated than just installing what's on Github. Here are the steps:
Fork the package to your own Github account if you have one. (This step is optional, but it makes some later steps easier.)
Download the source for the package. In RStudio, the quickest way to do this is to create a new project using Version Control, Git, and give the URL
of your forked copy, or the original URL if you skipped that.
Run Roxygen2 on the package. In RStudio, you do this by choosing "Document" in the "More" menu of the Build tab.
Try to build it. If you're lucky, it will now build properly. If not, fix the next problem.
This is very important: send your changes back to the original author. If you forked the package, this is easy; if not, figure out a way to do it.
this is the maintainer of the COMMultReg package. I didn't know about this thread until now, but it sounds like you were able to get started from the answer by user2554330.
The functions d_cmb, d_cmb_sample, etc are supposed to be exported. I think the problem may have been that, at the time of the question, I did not have src/RcppExports.cpp and R/RcppExports.R checked into Github. This seems to be necessary to use install_github on a package with exported Rcpp functions. Those were checked in around 8 months ago. (Coincidentally not long after this question was posted?)
Please let me know if you still having trouble with the install. Otherwise, enjoy the package!

"object not found" during package build/install

I'm at a loss to debug building/installing a package. Building a package "MyProjekt" through
> devtools::build("MyProjekt")
works fine, even though
> devtools::document()
Updating MyProjekt documentation
Loading MyProjekt
Error: object 'rank' not found whilst loading namespace 'MyProjekt'
fails.
Attempting to install the built (pure R) package
> install.packages(pkgs="./MyProjekt.tar.gz")
...
Error: package or namespace load failed for 'MyProjekt':
object 'rank' not found whilst loading namespace 'MyProjekt'
Error: loading failed
Execution halted
...
ERROR: loading failed for 'i386', 'x64'
also fails.
Unfortunately the term 'rank' is a common term in my domain and I have hundreds of hits when searching in my files for that term.
How might I start a systematic way to hunt this bug down?
The toolchain mistakenly generates S3method(...) in the NAMESPACE file.
Follow this answer and edit the NAMESPACE file by hand. Replace occurrences of S3method(f) with export(f).
I'm not certain this is repeatable. The generated files appear to be not just written, but also read during a subsequent package build (by devtools? by roxygen2?). Add your comments if this works/does not work for you.

Trouble installing and loading "mlrMBO" package in R

So when I install the package, R returns the following error message:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘mlrMBO’
But It then says the package has non-zero exit status and is in
‘/private/var/folders/b_/xwf1w6cn769_2gq06fntysxm0000gn/T/RtmpCGAr62/downloaded_packages’
When I load the package
library(mlrMBO)
It says the package doesn't exist.
I've tried many different methods like using this code
install.packages('mlr', repo='http://cran.fiocruz.br/')
Here's a couple of things you could try:
Make sure you don't have any Umlauts (ö,ä,ü, å) in your path, i.e. your User-folder, if you're running on windows.
Install devtools install.package("devtools)
clear data in \AppData\Local\Temp\
That package requires compiling C code, for which you have to install the Xcode developer tools.
Per Housemd's answer at Apple.SE:
Open Terminal, and run the following:
xcode-select --install
This will download and install xcode developer tools and fix the problem. The problem is that one needs to explicitly agree to the license agreement.
I found the solution in this question, Command Line Tools not working.
Once you've done that, run install.packages again.

Incompatible packages in meteor (autoform-file and velocity)

This might be a rather general question: How to deal with incompatible packages in meteor?
In my case I'm using the testing suite velocity and jasmine, which is not compatible with the current version of autoform-file package.
My html-reporter would just continue executing the test without actually getting the result due to the following error:
Errors prevented startup:
While selecting package versions:
error: Potentially incompatible change required to top-level dependency: yogiben:autoform-file 0.3.0, was 0.4.2.
Constraints on package "yogiben:autoform-file":
To allow potentially incompatible changes to top-level dependencies, you must pass --allow-incompatible-update on the command line.
Your application has errors. Waiting for file change.
I was thinking of downgrading the autoform-file package to 0.3.0 however, I didn't find any information on how to do it.
I was able to install the package at a specific version using:
meteor add yogiben:autoform-file#=0.3.0
That worked for me.

The specified module could not be found in R

I am developing a package using Rcpp and another third party C++ library. When I tried to install the package, I got
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/Admin/Documents/R/win-library/2.15/packagename/libs/i386/package.dll':
LoadLibrary failure: The specified module could not be found.
In 32-bit Windows OS, following an advice from my colleague, I fixed the problem by adding location of following dlls from MingW to system path.
libgcc_s_dw2-1.dll
But 64-bit Windows, I get the same error even with the dll although I am using 32-bit R.
So my question:
Is there any way to know why The specified module could not be found error occurs? I mean I would like to know which module is missing. Maybe verbose option some where?
There is not an easy way in R to get more information from the error I mentioned. But I found free software to find which dependency the dill is missing by following web site: http://www.dependencywalker.com/
Using the software I was able to find following dlls are needed to be in system path.
GPSVC.dll
IESHIMS.dll
SYSNIFY.dll
As hinted by the post Win 7, 64 bit, dll problems, the output of dependencywalker may be misleading. In my case, the path to "Microsoft SQL Server" was missing in my system %PATH% environment variable (deliberately removed, because it seemed unnecessary). After that the LoadLibrary error vanished and the library loaded.
I belive you can Run you R software as Administrator you can solve your problem...
You may check: Unable to load any package in R (unable to load shared object)
I ran into this same problem and the issue turned out to be that Windows was not looking in the right place for jvm.dll. Solution was to add location of this dll to Windows PATH variable.
Found solution here: Using the rJava package on Win7 64 bit with R
Instructions on how to edit PATH variable here: https://www.java.com/en/download/help/path.xml
I was also facing the error
"Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status".
I followed the following steps
restart the RStudio,
install.packages("tidyverse")
removed the folder C:/Users/CHILIKA/Documents/R/win-library/3.5/00LOCK-rlang
and again
install.packages("rlang")
then rlang sucessfully installed.

Resources