How can I tell whether/where python a virtualenv has been set up? (aka installing lxml on bitnami's djangostack)

I'm working on a django application on the bitnami djangostack. I want to use the lxml library, but I haven't been able to install it. Or rather, I haven't been able to install it where django can find it.

I've already used apt-get to install the libxml2, libxslt, and python-dev dependencies. Both of these commands report success*:

sudo pip install lxml
sudo apt-get install python-lxml

easy_install fails with a super-long error message that makes me think it can't find the dependencies. (I've run into this problem before.)

When I open up python or call python manage.py shell and try "import lxml", I get

"ImportError: No module named lxml"

As best I can tell, bitnami has set up a virtual environment for django, and pip and aptitude are installing lxml perfectly -- to the wrong python. Assuming that's all correct, how do I get lxml installed to the right one?

Answers


When you use apt-get install you are installing system libraries. BitNami DjangoStack is self-contained and independent. You could upgrade or remove your system libraries with apt-get and it would not be affected. Unfortunately lxml is not included in the stack nor libxslt which is a depency. We will include it in a future version however please find below the steps for manualing installing lxml on top of the python version included in BitNami DjangoStack.

You will need to use the system libraries for libxslt and libxml2. Be sure that you have them installed:

sudo apt-get install libxml2 libxml2-dev libxslt1.1 libxslt1-dev

Download lxml and uncompress it:

wget http://lxml.de/files/lxml-2.3.2.tgz
tar zxvf lxml-2.3.2.tgz
cd lxml-2.3.3

Load the BitNami environment:

. path_to_your_djangostack_installation/scripts/setenv.sh <-- notice the space between the dot and the path to the script.

which python <-- the output should be the python version from BitNami.

Install lxml specifying the path to your system libraries (notice that you should execute this command in the lxml directory):

python setup.py install --with-xslt-config=/usr/bin/xslt-config --with-xml2-config=/usr/bin/xml2-config

Now executing import lxml in the python console should work.

(This was already replied here)


Need Your Help

NDepend CQL reports methods as using Boxing/Unboxing incorrectly

c#-4.0 generics boxing ndepend

In NDepend 4 (v4.1.0.6871) I am using the default Design query "Boxing/unboxing should be avoided":

How to track changes on jqGrid columns/layout/order?

javascript jquery jqgrid

I have a jqGrid that can be sorted by different columns both in ascending and descending order. Columns may be added or removed, and the order of the columns may be changed too. I need to detect wh...