ubuntu 11.04 has native python2.7 i build python2.5 from source to /usr/local/python2.5/bin, and try to install lxml for my custom python2.5 install. Also i use virtualenv.
You cannot directly symlink different Python versions or native libraries, as Python DLL format changes across major Python versions.
Based on this:
"from lxml import etree" raise "ImportError: /home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/lxml-2.2.4-py2.5-linux-i686.egg/lxml/etree.so: undefined symbol: PyUnicodeUCS2_DecodeLatin1
It clearly states that lxml is somehow getting compiled against wrong version of Python. Usually this error stems from the problem that you have been mixing manually compiled Python interpreter with Ubuntu's default one, as Python interpreter can be compiled with different unicode flags and Ubuntu uses non-default flags (if I recall correctly).
Usually I solve this problem by
Creating a fresh virtualenv
Reinstalling lxml under this virtualenv using easy_install
Running Python using -v switch and Python will print everything it tries to import
If it is still importing stuff from wrong location either virtualenv or your native library setup has been corrupted
Native library setup can be overridden with manual lib builds and LD_LIBRARY_PATH environment variable
If virtualenv does not build lxml against your correct Python version it is virtualenv bug (as long as you can show how to reproduce this in a repeatable manner). However, we have been succesfully using lxml with Ubuntu, virtualenv and various Python versions so I doubt there is a bug.
There is also a way for static lxml installations using a tool called buildout (a little bit like virtualenv, but much much more complex):
http://groups.google.com/group/gomobile-dev/browse_thread/thread/7f5e34e991cfdaa9/c65b70e7a9422ebf?#c65b70e7a9422ebf