Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instructions lacking #2

Open
benman1 opened this issue Aug 1, 2018 · 4 comments
Open

Installation instructions lacking #2

benman1 opened this issue Aug 1, 2018 · 4 comments

Comments

@benman1
Copy link

benman1 commented Aug 1, 2018

Hi
This package looks really useful, but I find I am spending too much time trying to set it up. The first three steps are to install xgboost, then to point the weka package manager at the release zip file, which downloads the jar to wekafiles/. The third step is to include the new jar in the classpath in order to execute it. But then...

It's not enough to just install the shared library or the python xgboost package.
I am still getting the following:

Exception in thread "main" java.lang.NoClassDefFoundError: ml/dmlc/xgboost4j/java/XGBoostError
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.getDeclaredMethods(Class.java:1975)
        at weka.core.Option.addMethodsToList(Option.java:117)
        at weka.core.Option.listOptionsForClass(Option.java:135)
        at weka.core.Option.listOptionsForClassHierarchy(Option.java:96)
        at weka.classifiers.AbstractClassifier.listOptions(AbstractClassifier.java:244)
        at weka.classifiers.trees.XGBoost.listOptions(XGBoost.java:411)
        at weka.classifiers.evaluation.Evaluation.makeOptionString(Evaluation.java:4469)
        at weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1583)
        at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:668)
        at weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:141)
        at weka.classifiers.trees.XGBoost.main(XGBoost.java:789)
Caused by: java.lang.ClassNotFoundException: ml.dmlc.xgboost4j.java.XGBoostError
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 13 more

I am suspecting there's another dependency - xgboost4j. Please explain.

@mwasiluk
Copy link
Member

mwasiluk commented Aug 1, 2018

Hi,

what OS are you using? I've been using this package on ubuntu/mint, but I've got reports about problems on windows 10.

You can also try building the package yourself, using "mvn package" , but it requires running "mvn install" (or mvn -DskipTests install) on the https://github.com/dmlc/xgboost/tree/master/jvm-packages first.
More detailed description: https://xgboost.readthedocs.io/en/latest/jvm/index.html

The built package should be in target/dist/xgboost.zip

@benman1
Copy link
Author

benman1 commented Aug 1, 2018

Cheers, Michal, that's helpful.

I am using ubuntu bionic.
So far, I guess my list above should continue like this:

git clone https://github.com/dmlc/xgboost/tree/master/jvm-packages
cd xgboost/jvm-packages/xgboost4j
mvn  -DskipTests install && mvn package
CLASSPATH="$PWD/target/xgboost4j.jar:$CLASSPATH"

Maybe that'll fix the exception. I might give it a try later.

@sajjadAk
Copy link

sajjadAk commented Sep 4, 2018

Hi...
Trying to install xgboost on Windows 10, I have followed the mentioned instructions, yet it was not easy to build a shared library. I managed to install the shared library using TDM-GCC 86*64. Then include the new xgboost.jar in the classpath in order to execute it
CLASSPATH: C:\Users\139460\wekafiles\packages\XGBoost\xgboost.jar

While running xgboost through weka 3.9.2 I got the following

 Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Lml/dmlc/xgboost4j/java/Booster;
        java.lang.Class.getDeclaredFields0(Native Method)
        java.lang.Class.privateGetDeclaredFields(Class.java:2583)
        java.lang.Class.getDeclaredField(Class.java:2068)
        java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1857)
        java.io.ObjectStreamClass.access$700(ObjectStreamClass.java:79)
        java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:506)
        java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:494)
        java.security.AccessController.doPrivileged(Native Method)
        java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:494)
        java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:391)
        java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1134)
        java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        weka.core.SerializedObject.<init>(SerializedObject.java:93)
        weka.core.SerializedObject.<init>(SerializedObject.java:72)
        weka.gui.GenericObjectEditor.makeCopy(GenericObjectEditor.java:1937)
        weka.gui.GenericObjectEditor.getValue(GenericObjectEditor.java:1464)
        weka.gui.explorer.ClassifierPanel$3.propertyChange(ClassifierPanel.java:382)
        java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
        java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
        java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
        weka.gui.GenericObjectEditor.setObject(GenericObjectEditor.java:1450)
        weka.gui.GenericObjectEditor.setValue(GenericObjectEditor.java:1417)
        weka.gui.GenericObjectEditor.classSelected(GenericObjectEditor.java:1880)
...............


The issue is similar mentioned by "benman1"

Did you guys find any solution for this with windows 10*64?

@tiantian1516
Copy link

Hi,
XGBoost is a very useful classifier for weka, but i cant run it on Win10, even though i learned the xgboost.dll from cmake and vs by https://github.com/dmlc/xgboost and the databook of "building on Win10". In sad, the fault is always there:

Exception in thread "main" java.lang.NoClassDefFoundError: ml/dmlc/xgboost4j/java/XGBoostError
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
at java.base/java.lang.Class.getDeclaredMethods(Class.java:2504)
at weka.core.Option.addMethodsToList(Option.java:117)
at weka.core.Option.listOptionsForClass(Option.java:135)
at weka.core.Option.listOptionsForClassHierarchy(Option.java:96)
at weka.classifiers.AbstractClassifier.listOptions(AbstractClassifier.java:244)
at weka.classifiers.trees.XGBoost.listOptions(XGBoost.java:411)
at weka.classifiers.evaluation.Evaluation.makeOptionString(Evaluation.java:4652)
at weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1585)
at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:668)
at weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:141)
at weka.classifiers.trees.XGBoost.main(XGBoost.java:789)
Caused by: java.lang.ClassNotFoundException: ml.dmlc.xgboost4j.java.XGBoostError
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 13 more

I am suspecting there's a little bit missing for Win10 and java environment. Please explain.

Best wish for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants