[Python-modules-team] Bug#495457: python-numpy: Error while loading a library

Ondrej Certik ondrej at certik.cz
Sun Aug 17 15:49:15 UTC 2008


On Sun, Aug 17, 2008 at 5:07 PM, Christophe Combelles <ccomb at free.fr> wrote:
> Package: python-numpy
> Version: 1:1.1.0-3
> Severity: normal
>
>
> I get an error while trying to 'import svm'.
> libsvm is installed from source:
> http://scipy.org/svn/scikits/trunk/scikits/learn/scikits/learn/machine/svm/
>
>>>> import svm
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/lib/python2.5/site-packages/svm/__init__.py", line 62, in <module>
>    from classification import *
>  File "/usr/lib/python2.5/site-packages/svm/classification.py", line 5, in
> <module>
>    from model import Model
>  File "/usr/lib/python2.5/site-packages/svm/model.py", line 3, in <module>
>    from dataset import PrecomputedDataSet
>  File "/usr/lib/python2.5/site-packages/svm/dataset.py", line 3, in <module>
>    import libsvm
>  File "/usr/lib/python2.5/site-packages/svm/libsvm.py", line 15, in <module>
>    _libsvm = N.ctypeslib.load_library('libsvm_%s' % so_ext, __file__)
>  File "/usr/lib/python2.5/site-packages/numpy/ctypeslib.py", line 48, in
> load_library
>    for ln in libname_ext:
> UnboundLocalError: local variable 'libname_ext' referenced before assignment
>
>
> In numpy/ctypeslib.py, libname_ext is defined in a within a 'if' statement:
>     if '.' not in libname
> If the condition is not satisfied, libname_ext is not defined although it is
> used on line 48, thus leading to the error.
>
> In my case, the name of the lib is 'libsvm_.so'.

Thanks for the bug report. Could you please report it to the upstream
mailinglist? This seems like something they should fix in numpy.
Alternatively, you can also send a patch to python-numpy package in
Debian fixing this problem and I'll reupload. But send the patch to
upstream anyway please.

Ondrej





More information about the Python-modules-team mailing list