Richard W.M. Jones
2015-May-21 08:40 UTC
Re: [Libguestfs] [nbdkit python]: unable to locate modules
On Thu, May 21, 2015 at 09:32:48AM +0100, Richard W.M. Jones wrote:> On Thu, May 21, 2015 at 12:10:13AM -0400, Bill Speirs wrote: > > I'm working on a python plugin for nbdkit that treats Google Cloud > > Storage as a block device. I have a library, gcs.py, that implements > > simple commands: list, get, put, delete; source is here: > > https://github.com/wspeirs/cldblkdev/blob/master/gcs.py > > > > When I attempt to run nbdkit I get the following error: > > I get a slightly different error: > > Traceback (most recent call last): > File "/tmp/gcs.py", line 1, in <module> > import json > File "/usr/lib64/python2.7/json/__init__.py", line 108, in <module> > from .decoder import JSONDecoder > File "/usr/lib64/python2.7/json/decoder.py", line 5, in <module> > import struct > File "/usr/lib64/python2.7/struct.py", line 1, in <module> > from _struct import * > ImportError: /usr/lib64/python2.7/lib-dynload/_struct.so: undefined symbol: PyFloat_Type > nbdkit: error: /tmp/gcs.py: error running this script > > A smallest possible reproducer is to have a file that has a single line: > > import jsonI can fix it (for my simple json case) by doing: LD_PRELOAD=/usr/lib64/python2.7/lib-dynload/_json.so nbdkit python script=/tmp/json.py I wonder why Python doesn't dlopen the correct shared libraries? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Richard W.M. Jones
2015-May-21 09:34 UTC
Re: [Libguestfs] [nbdkit python]: unable to locate modules
Judging by this comment, it seems to be a generic problem with Python: https://github.com/blankwall/Python_Pin/issues/2#issuecomment-70569507 Strange. Anyway, patches welcome if you manage to solve this properly. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Bill Speirs
2015-May-21 14:03 UTC
Re: [Libguestfs] [nbdkit python]: unable to locate modules
What version of Python were you running for your test? $ python --version Python 2.7.9 Also, has anyone written a complex plugin for nbdkit that leverages shared libraries? I was hoping to hack this together quickly to test performance... Thanks! Bill- On Thu, May 21, 2015 at 5:34 AM, Richard W.M. Jones <rjones@redhat.com> wrote:> Judging by this comment, it seems to be a generic problem with > Python: > > https://github.com/blankwall/Python_Pin/issues/2#issuecomment-70569507 > > Strange. Anyway, patches welcome if you manage to solve this > properly. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-builder quickly builds VMs from scratch > http://libguestfs.org/virt-builder.1.html