0

I asked this on SO: https://stackoverflow.com/questions/19852911/lxml-3-1-2-and-lxml2-both-on-ubuntu/19856674#19856674

But it is perhaps more appropriate for AskUbuntu. So here it is again, reformulated.

On the lxml site they suggest that it is possible to have both lxml2 and the newest version of lxml on ubuntu:

Using lxml with python-libxml2

If you want to use lxml together with the official libxml2 Python bindings (maybe because one of your dependencies uses it), you must build lxml statically. Otherwise, the two packages will interfere in places where the libxml2 library requires global configuration, which can have any kind of effect from disappearing functionality to crashes in either of the two. To get a static build, either pass the --static-deps option to the setup.py script, or run pip with the STATIC_DEPS or STATICBUILD environment variable set to true, i.e. STATIC_DEPS=true pip install lxml The STATICBUILD environment variable is handled equivalently to the STATIC_DEPS variable, but is used by some other extension packages, too.

I am generally confused about how pip packages and ubuntu packages get along, so I hesitate to run STATIC_DEPS=true pip install lxml. Will it damage/confuse my installed lxml2 package?

The suggestion on SO was to install the new lxml in a virtualenv. That looks like the best way to go, but the lxml site is suggesting that a dual installation will work also.

In general: what happens if I use pip (to get a newer install) for a package that is already installed by apt-get?

0

Ubuntu makes extensive use of Python in it's distributions. For this reason, my policy is to leave the Ubuntu supplied versions strictly alone and only update them via the update manager or apt-get. In this way I avoid the risk of de-stabilizing some piece of Ubuntu code that is dependent on a particular python package/module version.

I do all my development work in virtualenv workspaces and configure my command line and Eclipse to use the appropriate workspace for whatever application I am working on. Thus I do not interfere with Ubuntu and Ubuntu does not interfere with me.

It is quite likely that a dual installation of lxml will "work" but the installation is likely to be fragile. Why take the risk?

  • Thanks for your suggestion. That seems to be the consensus: find a way to keep packages separate. – wgw Nov 20 '13 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.