[lttng-dev] babeltrace-python bindings

Julien Desfossez jdesfossez at efficios.com
Wed Nov 5 11:29:02 EST 2014


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
> 



More information about the lttng-dev mailing list