[lttng-dev] babeltrace-python bindings

Jérémie Galarneau jeremie.galarneau at efficios.com
Wed Nov 5 16:02:28 EST 2014

This commit in the master branch should perform the detection and
install the module under dist-packages when using Debian. Could anyone
confirm it works on Ubuntu? I can backport it to stable-1.2 if it

commit 1b39e2de5485147dd3dc7089c4edfd685d5cad96
Author: Jérémie Galarneau <jeremie.galarneau at efficios.com>
Date:   Thu Oct 16 16:36:10 2014 -0400

    Detect Python packages directory on configure

    The Python interpreter on Debian is configured to use
    ...lib/python.../dist-packages instead of
    .../lib/python.../site-packages to look for extra modules.

    python_modules.m4 performs a runtime python check of the
    sys.path variable to check wether the selected interpreter is
    configured to use site-packages vs dist-packages.

    Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>


On Wed, Nov 5, 2014 at 11:29 AM, Julien Desfossez
<jdesfossez at efficios.com> wrote:
> Hi,
> The problem resides with the default search path of Python on Debian/Ubuntu.
> When installing manually a Python library, it is installed in
> /usr/local/lib/python3.x/site-packages, but Python on Debian/Ubuntu does
> not look into this path but does look into dist-packages...
> So you can either symlink /usr/local/lib/python3.x/dist-packages so
> /usr/local/lib/python3.x/site-packages which is ugly.
> Or use this kind of hack at the beginning of your Python program :
> try:
>     from babeltrace import TraceCollection
> except ImportError:
>     # quick fix for debian-based distros
>     sys.path.append("/usr/local/lib/python%d.%d/site-packages" %
>                    (sys.version_info.major, sys.version_info.minor))
>     from babeltrace import TraceCollection
> You can have a look at this bug report about why it will probably never
> be fixed...
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765022
> I hope the workaround at least solves the problem you are having,
> Julien
> On 14-11-04 05:37 PM, Bin YE wrote:
>> Hi there
>> i have installed Lttng and babeltrace
>> my system:Ubuntu 14.04LTS
>> I have made following steps
>> sudo apt-add-repository ppa:lttng/ppa
>> sudo apt-get update
>> sudo apt-get install lttng-tools
>> sudo apt-get install lttng-modules-dkms
>> sudo apt-get install liblttng-ust-dev
>> export PYTHON="python3"
>> export PYTHON_CONFIG="/usr/bin/python3-config"
>> ./configure --enable-python-bindings
>>  make
>>  make install
>>  ldconfig
>> but i still can not use babeltrace python bindings
>> when i run import babeltrace it output error with no module
>> I really need you help about it
>> Thank you very much in advance
>> Bin Ye
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Jérémie Galarneau
EfficiOS Inc.

More information about the lttng-dev mailing list