Troubleshooting

General

  • Q: I cannot start the JVM once stopped - why?

    A: That’s unfortunately one of the limitations of the underlying jpype library: https://jpype.readthedocs.io/en/latest/api.html#jpype.shutdownJVM

  • Q: I’m getting ImportError: cannot import name 'find_namespace_packages' from 'setuptools' when trying to install jpype. How can I fix this?

    A: You seem to be using an old Python version. Try upgrading the setuptools library in your virtual environment using pip install -U setuptools.

Debian

  • Q: On a headless Debian server, building a classifier can result in Python exiting, printing the error message GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Not running within active session). How to fix?

    A: According to this post, set the following environment variable:

    export DBUS_SESSION_BUS_ADDRESS=""
    

    And make sure that the ~/.dbus directory has 0700 as permission mask.

Ubuntu

  • Q: On a headless Ubuntu server, building a classifier can result in Python exiting, printing the error message GLib-GIO-ERROR **: Settings schema ‘org.gnome.system.proxy’ is not installed. How to fix?

    A: Simply run the following command to fix this: sudo apt-get install gsettings-desktop-schemas

  • On Ubuntu, follow this post to install all the required dependencies for PIL:

    $ sudo apt-get build-dep python-imaging
    
  • To enable support for PIL on Ubuntu, see this post:

    $ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
    $ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
    $ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
    
  • Based on this post do the following to install matplotlib with tkinter support:

    sudo apt install tk-dev
    ./venv/bin/pip --no-cache-dir install -U --force-reinstall matplotlib
    

Linux

  • Q: I installed pygraphviz but I keep getting Pygraphviz is not installed, cannot generate graph plot!. How to fix?

    A: : Open up an interactive Python3 shell and type: import pygraphviz If you get undefined symbol: Agundirected, then follow the steps outlined here, but use pip3.

  • You may need to install the header files for the following libraries for the compilations to succeed:

    • freetype

    • graphviz

    • png

Windows

  • Q: I cannot display graphs, e.g., generated by J48, as I keep getting the error message ValueError: Program dot not found in path. - what can I do?

    A: PyGraphviz is just a wrapper for GraphViz which you you need to install separately. Also, you need to add the directory containing the GraphViz binaries, like dot.exe, to the PATH environment variable, e.g., C:\Program Files (x86)\Graphviz2.38\bin (you may have to log out and back in again for these changes to take effect).

  • Q: I cannot use datasets that are in UTF-8 - but it works in the Weka GUI when I change the file encoding parameter in RunWeka.ini!

    A: The JVM will pick up options via the _JAVA_OPTIONS environment variable. You can set an environment variables in your Python code with os.environ, e.g., the file encoding:

    import weka.core.jvm as jvm
    import os
    os.environ["_JAVA_OPTIONS"] = "-Dfile.encoding=UTF-8"
    jvm.start(packages=True)
    ...
    jvm.stop()