YARP and Python

From Wiki for iCub and Friends
Jump to: navigation, search

The current supported method for using YARP from Python is via SWIG. See:


Read the README in that directory.

If you go in there and run CMake ("ccmake ." on linux) you'll be presented with a bunch of language options (Java, Python, Perl, ...). Switch "CREATE_PYTHON" on, and then finish configuring. Then run "make". There may be lots of warnings from swig about language features that don't match exactly; it is usually safe to ignore these. Then hopefully the example in "example.py" will work for you.


Simple but important, don't forget to install python and python sources:

  sudo apt-get install python-dev python

On 64 bit machine, you need to compile YARP as dynamic/shared library (CREATE_SHARED_LIBRARY), otherwise you get the error:

 relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

To compile YARP as a dynamic/shared library, run the cmake GUI on the YARP build directory (see CMake icub for tips on how to do this) and toggle the "CREATE_SHARED_LIBRARY" switch to on. On UNIX, in ccmake, press the spacebar to toggle a switch.