wiki:DevEnvironment

Version 8 (modified by matija, 3 years ago) (diff)

Fix env.var names

Setting up Development Environment

The Bioinformatics Laboratory, which leads and hosts Orange development, employs a wide variety of researchers of developers. Each and every one of us has his/her own preference regarding the development environment. It is our intention on this page to present some of configurations we use that seem to work well.

At the moment, unfortunately, only one configuration is described: Eclipse under Linux, specifically Ubuntu.

Ubuntu & Eclipse

This procedure has been written for and tested on Ubuntu 11.04, but should also work for newer and older (down to 10.04) releases.

Package Installation

You need to install the following packages:

  • eclipse will be your IDE, and one of its plugins we will install needs libsvn-java to work,
  • make, g++, python-dev, python-numpy, python-matplotlib and python-imaging are needed to build and use the Orange scripting environment, and
  • python-qwt5-qt4 is needed in order for the Orange Canvas (GUI) to work,
  • python-sphinx, texlive-latex-base, texlive-latex-recommended, texlive-latex-extra and dvipng are needed to build the HTML documentation.

Beware that Sphinx has to be at least of version 1.0; Ubuntu 10.10 and older contain older versions of Sphinx, so you should not install the python-sphinx from apt repository, but find another way, such as easy_install sphinx.

This is the command to install all those packages in one shot:

sudo apt-get install eclipse libsvn-java make g++ python-dev python-numpy python-matplotlib python-imaging python-qwt5-qt4 python-sphinx texlive-latex-base texlive-latex-recommended texlive-latex-extra dvipng

If you wish to use Orange for network analysis, you also need a recent version of networkx; you can install it with:

sudo apt-get install python-setuptools
sudo easy_install networkx

Next, you need to run Eclipse and install the needed plugins: CDT (C/C++ Development Tooling), PyDev (Python IDE for Eclipse) and Subclipse (for Subversion repository support). Choose Help->Install New Software... and add the following Update Sites:

Choose –All Available Sites– for the "Work with" option and install the following choices: Subclipse, PyDev and CDT Main Features.

Obtaining the Code

Switch to the SVN Repository Exploring perspective and add the following repository location:  http://orange.biolab.si/svn/orange. Then browse into the trunk directory (or elsewhere, if you know what you're doing) and checkout source, orange and, optionally, testing (in this order). Use the "Check out as a project configured using the New Project Wizard" option for all projects and configure projects as follows.

For source, select C/C++->C++ Project. Select Makefile project->Empty Project->Linux GCC for Project type and Toolchain. Later in this guide it will be assumed you used the directory name (ie. source) for project name.

Under project properties, C/C++ Build->Environment, add the following environmental variables:

  • ORANGE_LIBDIR=${ProjDirPath}
  • CXXFLAGS=-ggdb
  • LDFLAGS=-ggdb

(If you intend to invoke make on the commandline, you can add those properties into the Makefile and makefile.defs.)

To accelerate the compilation process on a multi-processor or multi-core machine, you may instruct Eclipse to use parallel build (-j switch to the make): go to project properties for source project and under C/C++ Build->Behaviour check "Use parallel build". Manually enter a desired parallel jobs count; do NOT use "optimal jobs number": Eclipse likes to run all possible compilations at once and you'll probably run out of RAM.

For both orange and testing, select Pydev->Pydev Project. Later in this guide it will be assumed you used the directory name for project name (ie. orange and testing). Uncheck the "Create default 'src' folder" checkbox. Configure the interpreter if Eclipse requests so; you may use the Auto Config button with default settings. Select source as a referenced project of orange, and orange of testing.

Path Settings

To be able to run Orange, you need to add some directories to the PYTHONPATH. Here, we will assume you only have one version of Orange on your system and you want to use it from within Eclipse and also outside it. If you have more than one version of Orange, we'll assume you also know the best way to deal with your paths.

Open a terminal and go to your workspace directory (which contains at least orange and source directories). Now invoke the following:

( echo -e "$PWD/source\n$PWD/orange\n$PWD/orange/OrangeCanvas\n$PWD/orange/OrangeWidgets" && find $PWD/orange/OrangeWidgets -maxdepth 1 -type d -regex '[^\.].*' ) | sudo tee `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/orange.pth

You will need to provide your password, because sudo is used to write to a system directory. You may dissect the command to figure out what it does; it basically puts some paths in your workspace to a file orange.pth in python's dist-packages directory.

Enabling Running and Debugging

For debugging, it's best to set up three debug configurations: one for Python code, one for C++ code with Orange Canvas being invoked and one without Canvas to debug in python scripting environment. Choose Run->Debug Configurations and set up the following configurations.

Add a new "Python Run" configuration, name it orange-canvas-python, select orange as the project and OrangeCanvas/orngCanvas.pyw as the main module. Click apply.

Now add a new "C/C++ Application" configuration, name it orange-Cpp, select source as the project and /usr/bin/python as the C/C++ Application. Debugger (in the Debugger tab) should be set to "gdb Debugger" and "Stop on startup" not checked. You may now apply the configuration.

Now clone the last configuration, name it orange-canvas-Cpp and add, in the Arguments tab, type ${workspace_loc}/orange/OrangeCanvas/orngCanvas.pyw as program arguments.

Building the Documentation

To build the documentation, open a terminal and go to orange/doc/Orange directory. Invoke make html (preceded by make clean if you want to force a rebuild of all documentation). You should now have a html/index.html file with documentation index.