You are not logged in.

#1 2009-04-29 16:39:55

skorpan
Member
Registered: 2009-04-29
Posts: 10

How do I install lxml?

That's my question.  I manually downloaded and installed libxml2 and libxslt and they are both now available on my account. I somehow managed to install lxml using easy_install but now I've reached a dead end.

Code:

Error was: /home/yohan/lib/python2.5/lxml/etree.so: undefined symbol: PyUnicodeUCS4_FromEncodedObject

So has anyone installed lxml on WebFaction before? Could anyone try it and help me out?

The installation instructions are available at: http://codespeak.net/lxml/installation.html

Offline

 

#2 2009-04-29 17:06:30

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

I found another thread which deals with this problem: http://forum.webfaction.com/viewtopic.php?id=2037

However, it's quite cumbersome and I'd really like WebFaction to install lxml globally so that we don't have to go through all this trouble to do something which should be so simple.

Offline

 

#3 2009-04-29 17:08:43

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

I've just installed the lxml dependencies on your server, so you should now be able to install lxml via easy_install, eg:

Code:

easy_install-2.5 -s $HOME/bin -d $HOME/lib/python2.5 lxml

Hope that helps!

Offline

 

#4 2009-04-30 08:34:13

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

I did that and got no errors, but I still get the same error. It seems that I need to use a custom Python build with --enable-unicode=ucs2, which I have done, but I can't figure out how to make mod_python use that Python executable. The Django debug page always says that it's Python version 2.5.2!

So what is the right way to make mod_python use my own Python build?

Offline

 

#5 2009-04-30 08:43:36

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

skorpan wrote:

I did that and got no errors, but I still get the same error. It seems that I need to use a custom Python build with --enable-unicode=ucs2, which I have done, but I can't figure out how to make mod_python use that Python executable. The Django debug page always says that it's Python version 2.5.2!

How exactly can I reproduce the "undefined symbol: PyUnicodeUCS4_FromEncodedObject" error?

skorpan wrote:

So what is the right way to make mod_python use my own Python build?

If you want mod_python to use your own Python, then you'll need to build your own Apache from source, then build your own mod_python from source, against your custom Apache and Python installations. The steps will be very similar to those shown at http://forum.webfaction.com/viewtopic.php?id=2316 - the exceptions being a) you're building mod_python instead of mod_wsgi and b) the --with-python argument needs to point to your custom Python.

Offline

 

#6 2009-04-30 09:04:15

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

Currently, there is no way to reproduce the UCS4 problem, because I've fiddled around with the configuration a lot since then.

I tried building my own Apache, according to the instructions, but got compiler errors:

http://pastebin.com/m403db860

Offline

 

#7 2009-04-30 10:11:19

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

Since my last post I've been able to compile my custom Apache, Python 2.6.1 and mod_python 3.3.1. I'm currently writing a little HOWTO on this subject, as it's far from easy.

Offline

 

#8 2009-04-30 10:31:18

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

skorpan wrote:

Since my last post I've been able to compile my custom Apache, Python 2.6.1 and mod_python 3.3.1. I'm currently writing a little HOWTO on this subject, as it's far from easy.

If that has solved your issue, then great smile

If possible, I'd still like to know how to reproduce your original error "Error was: /home/yohan/lib/python2.5/lxml/etree.so: undefined symbol: PyUnicodeUCS4_FromEncodedObject".

For what it's worth, I noticed that when following the instructions I gave earlier for installing lxml, the path to etree.so is different, eg 'lib/python2.5/lxml-2.2-py2.5-linux-i686.egg/lxml/etree.so'. Since you said you had the same error after following my instructions, perhaps you needed to remove the original lxml library first.

Offline

 

#9 2009-04-30 11:09:50

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

I'm almost up and running now. I'm trying to figure out the right way to serve static files, e.g. CSS and JavaScript and such. When I'm done, if I feel like being completely generous, I'll throw together a little shell script to do exactly what I did. Then I'll write a little bit about how I configured Apache and what my file structure is.

Offline

 

#10 2009-04-30 11:13:57

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

The *best* way to serve static files is to create static-only applications in our control panel and map those apps to whatever URL paths on your website record. That way, your static files will be served by the front-end nginx server, which means less work (and less memory usage) for your private Apache instance smile

Offline

 

#11 2009-04-30 12:23:42

skorpan
Member
Registered: 2009-04-29
Posts: 10

Re: How do I install lxml?

Yep, that works. Is there any way to make the nginx server handle the static files without having to copy my media files from my directory to the other application's directory?

Offline

 

#12 2009-04-30 12:45:07

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

skorpan wrote:

Yep, that works. Is there any way to make the nginx server handle the static files without having to copy my media files from my directory to the other application's directory?

yes - use a 'symbolic link to static-only' application, with the full path to your static file directory in the 'extra info' field.

Offline

 

#13 2010-07-25 01:09:38

ChrisBrad51
Member
Registered: 2010-07-25
Posts: 1

Re: How do I install lxml?

I also have to face the same problem while downloading  libxml2. I hope I can fix this problem. I want to know more about "symbolic link to static-only" application. Thanks.


Here you can enjoy both Dinner and Movie.
Local Movie Theater is a place where you enjoy movies, dinner etc.

Offline

 

#14 2010-07-25 01:30:51

klynton
Administrator
From: Utah
Registered: 2009-08-31
Posts: 429
Website

Re: How do I install lxml?

Hi, you can use this process for installing the bindings:

Code:

You can install libxml2 and the lxml python bindings into your home directory with the following commands. Hope this helps!

#################

mkdir -p $HOME/bin $HOME/src $HOME/lib $HOME/include $HOME/share
cd $HOME/src

mkdir -p $HOME/lib/$PYTHON $HOME/src/tmp
cat > $HOME/.pydistutils.cfg << EOF
[build_ext]
include_dirs=$HOME/include
library_dirs=$HOME/lib
EOF
export PATH=$HOME/bin:$PATH
export TEMP=$HOME/src/tmp
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export LD_INCLUDE_PATH=$HOME/include/:$HOME/include/libxml2:$HOME/include/libxml2/libxml
cd $HOME/src
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz
tar -xzf libxml2-2.7.7.tar.gz
cd libxml2-2.7.7
./configure --prefix=$HOME
make && make install
cd $HOME/src
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -xzf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=$HOME --with-libxml-prefix=$HOME
make && make install
easy_install-$PYTHONVER http://pypi.python.org/packages/source/l/lxml/lxml-2.2.6.tar.gz

rm -rf $HOME/src/libxml2-2.7.7
rm $HOME/src/libxml2-2.7.7.tar.gz
rm -rf $HOME/src/libxslt-1.1.26
rm $HOME/src/libxslt-1.1.26.tar.gz
rmdir $HOME/src/tmp

What more info do you want about the "symbolic link to static-only" application?

Offline

 

#15 2010-07-27 11:01:23

seanf
Administrator
Registered: 2008-02-01
Posts: 1899
Website

Re: How do I install lxml?

Here's an easier way to install lxml:

Code:

mkdir $HOME/tmp
export TEMP=$HOME/tmp
CFLAGS="$CFLAGS -lgcrypt -fPIC" STATIC_DEPS=true easy_install-2.6 lxml

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson