Installation

The following sections should help you install the library on your machine.

Some of the instructions are based on the CellProfiler instructions, the guys behind the javabridge library.

However, if you should encounter problems or if you would like to submit improvements on the instructions below, please use the following mailing list:

https://groups.google.com/forum/#!forum/python-weka-wrapper

Videos

You can find videos on YouTube that show the installation process:

Prerequisites for all plaforms

You need an Oracle JDK (1.7+) installed and the JAVA_HOME environment variable pointing to the installation directory in order to use python-weka-wrapper3 library.

Why not OpenJDK? Weka is developed and tested with Oracle’s JDK/JRE. There is no guarantee that it will work with OpenJDK.

Ubuntu

First, you need to be able to compile C/C++ code and Python modules:

$ sudo apt-get install build-essential python3-dev

Now, you can install the various packages that we require for installing python-weka-wrapper3:

$ sudo apt-get install python3-pip python3-numpy

The following packages are optional, but necessary if you also want some graphical output:

$ sudo apt-get install python3-pil python3-matplotlib python-pygraphviz

Install OpenJDK as well, in order to get all the header files that javabridge compiles against (but don’t use it for starting up JVMs):

$ sudo apt-get install default-jdk

Finally, you can use pip3 to install the Python packages that are not available in the repositories:

$ sudo pip3 install javabridge
$ sudo pip3 install python-weka-wrapper3

Debian

First, become the superuser:

$ su

You need to be able to compile C/C++ code and Python modules:

$ apt-get install build-essential python3-dev

Now, you can install the various packages that we require for installing `python-weka-wrapper3:

$ apt-get install python3-pip python3-numpy

The following packages are optional, but necessary if you also want some graphical output:

$ apt-get install python3-imaging python3-matplotlib python-pygraphviz

Download an Oracle JDK and un-tar it in /opt (e.g., /opt/jdk1.7.0_75/). Export the Java home directory as follows (required for the javabridge installation):

$ export JAVA_HOME=/opt/jdk1.7.0_75/

Finally, you can use pip3 to install the Python packages that are not available in the repositories:

$ pip3 install javabridge
$ pip3 install python-weka-wrapper3

Please note, when using python-weka-wrapper3 as a normal user, don’t forget to export the JAVA_HOME environment variable as described above (e.g., add it to your .profile).

Fedora/CentOS/Redhat

Here are some rough instructions (as superuser):

  • install openjdk (+ -devel) package
  • install python (+ -devel) package
  • download pip from https://bootstrap.pypa.io/get-pip.py
  • install pip using python get-pip.py
  • install dev tools using yum groupinstall "Development tools"
  • install numpy package
  • install python-imaging package (shouldn’t be necessary)
  • install javabridge using pip javabridge
  • install python-weka-wrapper3 using pip python-weka-wrapper3

Other Linux distributions

See these general instructions for installing Python on Linux. You need to be able to compile C/C++ code and Python modules (i.e., Python header files are required). By installing OpenJDK, you should be able to compile javabridge against its header files (for JNI access).

Then you need to install the following Python packages, preferably through your package manager (e.g., yum). Please note that on a headless machine, you can omit the packages marked as optional, as they are only required for graphical output and plots:

  • pip3
  • numpy
  • PIL (optional)
  • matplotlib (optional)
  • pygraphviz (optional)

Once these libraries are installed, you can use pip3 to install the remaining Python packages:

$ sudo pip3 install javabridge
$ sudo pip3 install python-weka-wrapper3

Mac OSX

Please follow these general instructions for installing Python.

In order to compile C/C++ code, you need to install Xcode through Apple’s App Store. Once installed you can install the XCode command-line tools by issuing the command xcode-select --install in a terminal.

Also, install graphviz using homebrew (brew install pkg-config and brew install graphviz) for visualizing trees and graphs.

You need to install the following Python packages:

  • numpy
  • pillow
  • matplotlib
  • pygraphviz

Once these libraries are installed, you can use pip to install the remaining Python packages:

$ pip3 install javabridge
$ pip3 install python-weka-wrapper3

Windows

Please note: You need to make sure that the bitness of your environment is consistent. I.e., if you install a 32-bit version of Python, you need to install a 32-bit JDK and 32-bit numpy (or all of them are 64-bit).

Perform the following steps:

  • install Python, make sure you check Add python.exe to path during the installation
  • add the Python scripts directory to your PATH environment variable, e.g., C:\\Python27\\Scripts
  • install pip with these steps:
  • download from here
  • install using python get-pip.py
  • install numpy
  • download numpy 1.9.x MKL (or later) for Python 3.4/3.5 (cp34/cp35) and your bitness (32 or 64 bit)
  • install the .whl file using pip: pip install numpy-X.Y.Z.whl
  • install javabridge
  • download javabridge (or later) for Python 3.4/3.5 (cp34/cp35) and your bitness (32 or 64 bit)
  • install the .whl file using pip: pip install javabridge-X.Y.Z.whl

If you want to use the plotting functionality, you need to install matplotlib as well:

  • download matplotlib for Python 3.4/3.5 (cp34/cp34) and your bitness (32 or 64 bit)
  • install the .whl file using pip: pip install matplotlib-X.Y.Z.whl
> pip install python-weka-wrapper

For being able to compile libraries on Windows, you need the Microsoft Build Tools 2015 installed.

From source

You have two options for installing the library from source, either through a release archive or using the bleeding edge source code that is available through the Github repository.

Archive

Go to the releases page on Github and download the Source code archive (zip or tar.gz) of the release that you want to install. After the download finishes, decompress the archive. Open a terminal/command prompt and execute the following command from within the directory with the setup.py file:

$ python3 setup.py install

Check out the section on virtualenv as well, if you would rather install it in a disposable location.

Gtihub

Clone the Github repository as follows:

git clone https://github.com/fracpete/python-weka-wrapper3.git

Change into the newly created directory and install the library using the following command:

$ python3 setup.py install

Check out the section on virtualenv as well, if you would rather install it in a disposable location.

Table Of Contents

Previous topic

Introduction

Next topic

Troubleshooting

This Page