ppackage issue with importing a .so file (TOUGH ONE)

I recently tried to convert my app to .p3d and came across a problem I can’t hack through. Well, I urgently need to include the “lxml” library in my project. The problem is I can’t find a way to properly include lxml/etree.so so that it will import and work. So far I’m testing it on a following main.py:

from lxml import html

Here’s the pdef file:

import sys

sys.path.insert(0,'')

class MyP3D(p3d):
    require('morepy')
    sys.path.append('/usr/share/pyshared')
    sys.path.append('/usr/lib/python2.6/dist-packages')
    config(
        version="0.0",
        display_name = "MyP3D")

    module('lxml')
    file('/usr/lib/python2.6/dist-packages/lxml/etree.so',newDir='lxml')

    mainModule('main')

And this is the output:


> ppackage -i output_dir WTF.pdef                  
:Packager: Reading WTF.pdef
There are some missing modules: ['lxml.etree']
Generating MyP3D.0.0.linux_i386.p3d
> panda3d output_dir/MyP3D.0.0.linux_i386.p3d      
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "main.py", line 1, in <module>
  File "VFSImporter", line 153, in load_module
  File "/usr/share/pyshared/lxml/html/__init__.py", line 8, in <module>
    from lxml import etree
  File "VFSImporter", line 127, in load_module
  File "VFSImporter", line 228, in _import_extension_module
ImportError: /usr/lib/libxml2.so.2: undefined symbol: gzopen64
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 411, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 496, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 454, in step
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "main.py", line 1, in <module>

I would also like to report an EXTREMELY annoying bug with paths - for some reason ppackage tries to run /bin/sh -c ldd somefile > OtherFile and can’t run it because of messed up environment variables. I bypassed it by replacing /bin/sh with my own script fixing the PATH, but it’s an ugly hack. It’s also reported HERE. Here’s where it’s looking for ldd:

> strace -s 300 -fdv ppackage -i output_dir WTF.pdef 2>&1 | grep -i ldd
[pid 16653] execve("/bin/sh", ["sh", "-c", "ldd \"/usr/lib/python2.6/dist-packages/lxml/etree.so\" >\"/tmp/p3d_fwHGvY\""], ["LANGUAGE=", "KDE_MULTIHEAD=false", "KDE_SESSION_VERSION=4", "KONSOLE_DBUS_SERVICE=:1.36", "LOGNAME=deetah", "WINDOWPATH=7", "GTK_MODULES=canberra-gtk-module", "GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/deetah/.gtkrc-2.0:/home/deetah/.gtkrc-2.0-kde4:/home/deetah/.kde/share/config/gtkrc-2.0", "KDE_FULL_SESSION=true", "SHLVL=1", "DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-eDgkbWF6J9,guid=ce6a64a0d519155c1af284cf4c86bae7", "USER=deetah", "LANG=pl_PL.UTF-8", "GTK_RC_FILES=/etc/gtk/gtkrc:/home/deetah/.gtkrc::/home/deetah/.kde/share/config/gtkrc", "WINDOWID=48234535", "XDM_MANAGED=method=classic,auto", "XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share", "DM_CONTROL=/var/run/xdmctl", "_=/usr/bin/strace", "DISPLAY=:0.0", "PWD=/home/deetah/projekty/python/pynk/ppd/tiny", "XCURSOR_THEME=oxy-white", "GS_LIB=/home/deetah/.fonts", "COLORFGBG=15;0", "KDE_SESSION_UID=1000", "SSH_AGENT_PID=1283", "XDG_SESSION_COOKIE=8301149227d6e8371b57ae224b7f2749-1283898087.316820-386313914", "OLDPWD=/home/deetah/projekty/python/pynk/ppd", "TERM=xterm", "PROFILEHOME=", "SESSION_MANAGER=local/deetah-laptop:@/tmp/.ICE-unix/1616,unix/deetah-laptop:/tmp/.ICE-unix/1616", "QT_PLUGIN_PATH=/home/deetah/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/", "SSH_AUTH_SOCK=/tmp/ssh-FYtJNS1239/agent.1239", "KONSOLE_DBUS_SESSION=/Sessions/6", "DESKTOP_SESSION=default", "HOME=/home/deetah", "GPG_AGENT_INFO=/tmp/gpg-iFYxq2/S.gpg-agent:1284:1", "SHELL=/bin/zsh", "LC_ALL=pl_PL.utf8", "ECHANGELOG_USER=Dawid W\304\231gli\305\204ski <cla@gentoo.org>", "WORDCHARS=*?_[]~\\!#$%^<>|`@#$%^*()+?", "PS1=%{\33[0;32m%}%(!.#.>) %{\33[0m%}", "GREP_COLOR=31", "HISTSIZE=5000", "HISTFILE=/home/deetah/.history_zsh", "SAVEHIST=4000", "EDITOR=/usr/bin/vim", "PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "LD_LIBRARY_PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "DYLD_LIBRARY_PATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PYTHONPATH=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PYTHONHOME=", "PRC_PATH=/home/deetah/.panda3d/prc:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "PANDA_PRC_PATH=/home/deetah/.panda3d/prc:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7:/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "TEMP=/tmp/", "PANDA3D_ROOT=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7", "EGG_ROOT=/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7"] [wait(0x57f) = 16653]
[pid 16653] stat64("/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/egg/cmu_1.7/ldd",  [wait(0x57f) = 16653]
[pid 16653] stat64("/home/deetah/.panda3d/hosts/runtime.panda3d.org_96a0ec538744def6/panda3d/cmu_1.7/ldd",  [wait(0x57f) = 16653]
[pid 16653] write(2, "ldd: not found", 14ldd: not found [wait(0x57f) = 16653]

The funny thing is, whenever I copy ldd to the mentioned dir where it looks for it, the binary gets removed. Any better workarounds/solutions? So far, I’m completely doomed by these two errors.

Hmm, compiled C++ modules still don’t work 100% in a p3d file. It might work, though, if you copied the whole lxml tree into your package directory.

As to the path problem, that’s a strange one. I’m not sure why it’s losing the PATH setting from your environment. Of course it shouldn’t be looking for ldd only within your panda3d directory. Hmm, do you also have a ppackage.p3d file, or only the ppackage executable?

David

I’m running the executable from /usr/bin. I also tried running the raw script, but it doesn’t know where to look for extensions:

> python /usr/share/panda3d/direct/p3d/ppackage.py -i output_dir WTF.pdef 
:Packager: Reading WTF.pdef
Unknown package morepy, version "None" on line 6 of WTF.pdef

But this one might be because ppackage run this way loses all its environment settings:

> strace -s 300 -fdv python /usr/share/panda3d/direct/p3d/ppackage.py -i output_dir WTF.pdef 2>&1 | grep execve
execve("/usr/bin/python", ["python", "/usr/share/panda3d/direct/p3d/ppackage.py", "-i", "output_dir", "WTF.pdef"], ["LANGUAGE=", "KDE_MULTIHEAD=false", "KDE_SESSION_VERSION=4", "KONSOLE_DBUS_SERVICE=:1.36", "LOGNAME=deetah", "WINDOWPATH=7", "GTK_MODULES=canberra-gtk-module", "GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/deetah/.gtkrc-2.0:/home/deetah/.gtkrc-2.0-kde4:/home/deetah/.kde/share/config/gtkrc-2.0", "KDE_FULL_SESSION=true", "SHLVL=1", "DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-eDgkbWF6J9,guid=ce6a64a0d519155c1af284cf4c86bae7", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/deetah/bin", "USER=deetah", "LANG=pl_PL.UTF-8", "GTK_RC_FILES=/etc/gtk/gtkrc:/home/deetah/.gtkrc::/home/deetah/.kde/share/config/gtkrc", "WINDOWID=48234535", "XDM_MANAGED=method=classic,auto", "XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share", "DM_CONTROL=/var/run/xdmctl", "_=/usr/bin/strace", "DISPLAY=:0.0", "PWD=/home/deetah/projekty/python/pynk/ppd/tiny", "XCURSOR_THEME=oxy-white", "GS_LIB=/home/deetah/.fonts", "COLORFGBG=15;0", "KDE_SESSION_UID=1000", "SSH_AGENT_PID=1283", "XDG_SESSION_COOKIE=8301149227d6e8371b57ae224b7f2749-1283898087.316820-386313914", "OLDPWD=/home/deetah/projekty/python/pynk/ppd", "TERM=xterm", "PROFILEHOME=", "SESSION_MANAGER=local/deetah-laptop:@/tmp/.ICE-unix/1616,unix/deetah-laptop:/tmp/.ICE-unix/1616", "QT_PLUGIN_PATH=/home/deetah/.kde/lib/kde4/plugins/:/usr/lib/kde4/plugins/", "SSH_AUTH_SOCK=/tmp/ssh-FYtJNS1239/agent.1239", "KONSOLE_DBUS_SESSION=/Sessions/6", "DESKTOP_SESSION=default", "HOME=/home/deetah", "GPG_AGENT_INFO=/tmp/gpg-iFYxq2/S.gpg-agent:1284:1", "SHELL=/bin/zsh", "LC_ALL=pl_PL.utf8", "ECHANGELOG_USER=Dawid W\304\231gli\305\204ski <cla@gentoo.org>", "WORDCHARS=*?_[]~\\!#$%^<>|`@#$%^*()+?", "PS1=%{\33[0;32m%}%(!.#.>) %{\33[0m%}", "GREP_COLOR=31", "HISTSIZE=5000", "HISTFILE=/home/deetah/.history_zsh", "SAVEHIST=4000", "EDITOR=/usr/bin/vim"] [wait(0x57f) = 18100]

You shouldn’t attempt to run ppackage.py directly. You should only run it as ppackage.p3d (or the executable which ships with the SDK, which is really just a wrapper around ppackpage.p3d)

I did. I just found it extremely hard to debug a pre-compiled executable, so I tried to run the script. Tough, though. The os.system calls urgently need to be fixed. And I still dunno how to correctly add lxml.

I’ll see if I can reproduce the ldd issue. What kind of system are you running on? How did you install ppackage.p3d?

As to lxml, as I said, you can try copying the entire lxml package into your application directory. Other than that, the “correct” way to link with it is to build lxml into its own package, and host that package on your own server, then reference the package with the -r parameter to ppackage. Alternatively, you can switch to a different xml package (depending on your precise needs), such as sax, which is available in morepy, or tinyxml, which is compiled in and available as part of Panda itself.

David

I downloaded the .deb SDK package for Ubuntu and installed it via dpkg. These are the results after copying and including the whole directory with etree.so included:


> ppackage -i output_dir WTF.pdef                                      
:Packager: Reading WTF.pdef
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/ppackage.py", line 200, in <module>
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 2246, in readPackageDef
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 2352, in endPackage
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 403, in close
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 493, in installMultifile
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 845, in done
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 919, in __loadModule
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 1358, in load_module
  File "/usr/local/lib/python2.6/modulefinder.py", line 305, in load_module
  File "/usr/local/lib/python2.6/modulefinder.py", line 414, in scan_code
  File "/usr/local/lib/python2.6/modulefinder.py", line 323, in _safe_import_hook
  File "/usr/local/lib/python2.6/modulefinder.py", line 125, in import_hook
  File "/usr/local/lib/python2.6/modulefinder.py", line 162, in determine_parent
KeyError: 'html'
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 411, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 496, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 454, in step
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/ppackage.py", line 200, in <module>
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 2246, in readPackageDef
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 2352, in endPackage
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 403, in close
  File "/Users/rdb/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/Packager.py", line 493, in installMultifile
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 845, in done
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 919, in __loadModule
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showutil/FreezeTool.py", line 1358, in load_module
  File "/usr/local/lib/python2.6/modulefinder.py", line 305, in load_module
  File "/usr/local/lib/python2.6/modulefinder.py", line 414, in scan_code
  File "/usr/local/lib/python2.6/modulefinder.py", line 323, in _safe_import_hook
  File "/usr/local/lib/python2.6/modulefinder.py", line 125, in import_hook
  File "/usr/local/lib/python2.6/modulefinder.py", line 162, in determine_parent
KeyError: 'html'
Successfully joined thread: 0
Failure on startup.

The pdef file:


import sys
sys.path.insert(0,'') 


class MyP3D(p3d):
    packager.binaryExtensions.append('so')
    require('sqlite','panda3d','morepy')
    sys.path.append('/usr/share/pyshared')
    sys.path.append('/usr/lib/python2.6/dist-packages')
    config( 
        version="0.0", 
        display_name = "MyP3D") 
    module('mechanize')
    #module('lxml.*')
    excludeModule('cjkcodecs.aliases')
    excludeModule('config')
    excludeModule('iconv_codec')
    excludeModule('panda3d.core')
    dir('lxml')
    mainModule('main')

Uncommenting the module line doesn’t change anything.

Which version of lxml do you have installed? It looks like that package may be doing something sneaky with the sys.path. I’ll have to investigate it. I don’t see that the ldd problem is actually causing you any trouble at this point.

David

dpkg -l | grep lxml
ii python-lxml 2.2.4-1 pythonic binding for the libxml2 and libxslt

OK, I’ve tracked down the ldd issue, and it turns out to be something that we’ve already fixed on the cvs trunk, and which will be part of the next Panda3D runtime update.

I haven’t been able to reproduce your problem with lxml, though. I have Ubuntu lucid, the same version of lxml as you, and I am able to construct your package with your pdef file with no special effort. It finds lxml perfectly, even copies etree.so into the p3d file, right out of the box.

So, I’m not sure why modulefinder is failing in your case. But others have reported issues with modulefinder not doing the right thing, also. Hmm, could some additional package you have installed possibly be interfering with modulefinder’s behavior? Or some other strange interaction?

David

Well, as you can see in the quoted pdef, there’s also mechanize and sqlite (as a part of dependencies). Could you copy me your pdef?

I used the pdef file quoted in your OP successfully. Does that one give you the same problems? I can try the second pdef file too, but it will take me a little while–I’m about to go out for a few hours.

David

Yeah, they all do. Do you use the ppackage from CVS or 1.7.0?

I installed the 1.7.0 package and the 1.0.0 runtime.

Hmm, now that I look more closely at the stack traces in your thread, I see that there are really two separate problems here.

(1) the ldd problem, which is causing the package to be built without libxml2.so, or other possible dependencies on etree.so. This means your p3d file gets built, but it may not be runnable.

(2) some weird modulefinder crash when you run ppackage with a more exotic situation. Perhaps this is caused by the monkeying around with sys.path, which causes the wrong version of modulefinder.py to be loaded into ppackage? (Actually, excluding panda3d.core in your pdef file is probably a bad idea, though I don’t think this is the cause of this particular problem. It currently reports panda3d.core as a missing module, but you should ignore this spurious warning, which will be fixed in the next runtime release.)

Ah, I bet it’s the dir(‘lxml’) line that causes the modulefinder error. That’s not really the way that Python modules are meant to be loaded.

So, it all comes back to (1), as you originally reported, which is the fact that ldd is not being properly invoked by ppackage. This is great, since this problem has already been solved, but due to bureaucratic inefficiencies, has not yet been released. Our apologies for this delay. We do hope to get a new release out before too much more time has elapsed.

In the meantime, one workaround (other than your /bin/sh hack) might be to include each of the required .so files with an explicit file() command.

Note that including .so files into a p3d file will make it platform-specific.

David

But I guess I have no choice if I want to use lxml, right?

Just in case, in @up I meant that I have no choice but to include pre-compiled libraries if I want to stick with lxml, am I right?

Anyway, I understand I can’t move on without upgrading the SDK to CVS. The problem is makepanda doesn’t seem idiot-friendly enough for me. I ran it successfully and yet there was no new ppackage in the “built” directory. What else should I do?

Right, you do have to include the .so files, but not necessarily in the p3d file itself. If you want to make your p3d file platform-independent, then you can build an lxml package. You will need to build an lxml package for each platform you want to support.

I think you misunderstand. I wasn’t suggesting that you should upgrade your development tree to the cvs trunk; and doing this won’t help you anyway, because ppackage is specifically tied to the version of Panda that it was built with (so you need to use the ppackage that is tied to the version that is actually hosted somewhere, unless you plan to host the version that you are building for yourself).

My suggestion was to work around the problem by explicitly naming each .so file that needs to be included with the file() command in your pdef file.

David

Okay, I’ll try. And what about the ldd problem? Any workarounds for that?

I also wonder if I could use the new ppackage and then apply pdeploy to make a standalone Windows executable - that’s what I ultimately want to achieve. If it’s possible, how to build the new ppackage environment? Snapshot builds don’t include the p3d file, it’s not automatically built by makepanda…

Also, including the libxml .so file doesn’t change anything:

> cat WTF.pdef && ppackage -i output_dir WTF.pdef && multify -t -f output_dir/MyP3D.0.0.linux_i386.p3d | grep '\.so' && panda3d output_dir/MyP3D.0.0.linux_i386.p3d 
import sys
sys.path.insert(0,'') 


class MyP3D(p3d):
    packager.binaryExtensions.append('so')
    require('sqlite','panda3d','morepy')
    sys.path.append('/usr/share/pyshared')
    sys.path.append('/usr/lib/python2.6/dist-packages')
    config( 
        version="0.0", 
        display_name = "MyP3D") 
    module('mechanize')
#    file('/usr/lib/libxml2.so.2.7.6')
    file('/usr/lib/libxml2.so.2.7.6',newDir='lxml')
    file('lxml/etree.so',newDir='lxml')
    #module('lxml.*')
    excludeModule('cjkcodecs.aliases')
    excludeModule('config')
    excludeModule('iconv_codec')
    excludeModule('panda3d.core')
    #dir('lxml')
    mainModule('main')
:Packager: Reading WTF.pdef
sh: ldd: not found
Generating MyP3D.0.0.linux_i386.p3d
lxml/etree.so
lxml/libxml2.so.2.7.6
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "main.py", line 4, in <module>
  File "VFSImporter", line 153, in load_module
  File "pynk.py", line 27, in <module>
  File "VFSImporter", line 153, in load_module
  File "lxml/html/__init__.py", line 8, in <module>
  File "VFSImporter", line 127, in load_module
  File "VFSImporter", line 228, in _import_extension_module
ImportError: /usr/lib/libxml2.so.2: undefined symbol: gzopen64
:task(error): Exception occurred in PythonTask Messenger-default
Traceback (most recent call last):
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 411, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 496, in run
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/task/Task.py", line 454, in step
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 352, in __taskChainDispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/showbase/Messenger.py", line 410, in __dispatch
  File "/root/pandaworker/panda3d-1.7.0/built_cmu/direct/p3d/AppRunner.py", line 493, in __startIfReady
  File "VFSImporter", line 153, in load_module
  File "main.py", line 4, in <module>
  File "VFSImporter", line 153, in load_module
  File "pynk.py", line 27, in <module>
  File "VFSImporter", line 153, in load_module
  File "lxml/html/__init__.py", line 8, in <module>
  File "VFSImporter", line 127, in load_module
  File "VFSImporter", line 228, in _import_extension_module
ImportError: /usr/lib/libxml2.so.2: undefined symbol: gzopen64
Successfully joined thread: 0
Failure on startup.

Replacing the file() expression with the commented one doesn’t help either.