jpmml / r2pmml

R library for converting R models to PMML
GNU Affero General Public License v3.0
73 stars 18 forks source link

Conversion fails in RStudio, but succeeds in command-line #50

Closed VaradDaniel closed 5 years ago

VaradDaniel commented 5 years ago

I get the following error when I try to run the example code for Xgboost.

Error in .convert(tempfile, file, converter, converter_classpath, verbose) : 127

I have Java installed, get the following when I run java -version in cmd. java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

Can you please help ?

Thanks!

VaradDaniel commented 5 years ago

Ok, I just tried running this code on R ( earlier I was trying to run it on RStudio ) and it ran perfectly and has produced a pmml file.

Any clues to what might be throwing the error when I try to run it via RStudio ?

thanks Dan9ie

vruusmann commented 5 years ago

That must be some generic system setup issue.

What is your OS? What are your R and RStudio versions?

Does the conversion fail only with XGBoost models, or with all other models (eg. glm()) as well?

VaradDaniel commented 5 years ago

Running win 10, R 3.5.1 and RStudio 1.1.456 ( 64 bit versions of both ). It works now, but I had only restarted the system once.

For Java, after installing a recent version ( newer than 1.7 ), is there a need to assign any particular environment variables, like Path or JAVA_HOME and point these to your Java bin directories ? I read something like this on maybe stack exchange and had tried setting these up. Maybe that fixed it.

I would be great to know the exact (or recommended) machine and Java setup necessary, as have to get this working on my work machine and have less user priviledges on that machine. Thanks.

vruusmann commented 5 years ago

For Java, is there a need to assign any particular environment variables?

When doing any Java work, then it's advisable to set up the following environment:

  1. Export the JAVA_HOME env. variable, which points to the base directory of the Java installation that you want to use. You could have multiple Java installations, and depending on the task at hand, you could then switch them by re-exporting this env. var.
  2. Append the JAVA_HOME/bin to the PATH env. var. This will make the java.exe available on system path, which is the only prerequisite for using R2PMML, SkLearn2PMML etc conversion packages.

For example (UNIX-like system):

$ export JAVA_HOME=/opt/jdk1.8.0_160
$ export PATH=$PATH:$JAVA_HOME/bin

I'm keeping this issue open until I have successfuly managed to reproduce the 127 error code. However, I'm fairly sure that it happens because you didn't have java.exe on your system path (maybe you should have restarted your Windows computer one more time).

VaradDaniel commented 5 years ago

Yes, I have managed to make the example run and exported on my work machine after getting a recent version of Java installed. So this issue can be closed.

on a different note, Can you point me to some documentation on v0.13.1 ? I want to check if I am using the correct parameters while exporting a particular model. Getting some errors while exporting a particular model, it starts running and then fails half-way through. Happy to share more details offline if you would like.

I have to use the older version of the package since only pmml files exported through the old version load successfully on a particular software platform we use. The files exported from more recent versions fail to load, potentially due to any formatting changes/functionalities which you may have added afterwards.

Thanks!

vruusmann commented 5 years ago

Can you point me to some documentation on v0.13.1?

See the 0.13.1 release tag: https://github.com/jpmml/r2pmml/releases/tag/0.13.1

Specifically, here's the corresponding README file: https://github.com/jpmml/r2pmml/blob/0.13.1/README.md

The R2PMML package inherits almost all of its functionality from the JPMML-R library; the R2PMML package version 0.13.1 is based on JPMML-R library version 1.2.16, so you might want to go through its README as well: https://github.com/jpmml/r2pmml/commit/b435f4754044053620886915c341af59cb1d0f4d https://github.com/jpmml/jpmml-r/releases/tag/1.2.16 https://github.com/jpmml/jpmml-r/blob/1.2.16/README.md