Search code examples
pythoninstallationweb2pyweb2py-modulesxml.etree

How to install lxml.etree directly to web2py modules?


I have a working setup of lxml.etree working on my windows desktop.

Since I wanted to move this to my server, instead of installing lxml in sitepackages, I wanted to install it inside the modules directly, so this lxml version is specific to this applicaion/site.

I copied my lxml directory directly under modules on the linux server, and I got this error :

No module named etree

So it seems it understood there is an lxml, package but couldn't see etree inside it. Any ideas ? Also, I couldn't find exactly where I can download the binaries for ubuntu 9.10 on the site : http://lxml.de/installation.html#installation


Solution

  • You can't just copy the Windows version over to a Linux server; lxml uses C extensions which need to be compiled for the target platform.

    The etree module is such a compiled extension, on Linux that'd be etree.so, while on Windows it would be a etree.dll file instead, for example.

    For Ubuntu, look for python-lxml, or install the dependencies libxml2-dev, libxslt1-dev and python-dev, plus python-pip, then use sudo pip install lxml to install lxml on your server.