Hello,<br><br>I am trying to get the Windows lxml egg to work with Cygwin, Python 2.5.2 on WindowsXP, 32bit. I wasn&#39;t able to find a Cygwin package for lxml so I felt I needed to obtain or build a win32 version of lxml. I want to use the xpath functionality that lxml provides in python scripts, running in Cygwin.<br>
<br>*** All commands below are issued in a Cygwin bash shell ***<br><br>I downloaded <span style="white-space: nowrap;"></span><a href="http://pypi.python.org/packages/2.5/l/lxml/lxml-2.2.1-py2.5-win32.egg#md5=e7848267af1916a689927bdd1432abb4">lxml-2.2.1-py2.5-win32.egg</a> from <a href="http://pypi.python.org/pypi/lxml/2.2.1">http://pypi.python.org/pypi/lxml/2.2.1</a> and placed it in a directory, setting PYTHONPATH to point here too. However pkg_resources.require() can&#39;t find it, so instead I unzipped it into a directory called &#39;lxml&#39;. Then I do this:<br>
<br>$ python<br>Python 2.5.2 (r252:60911, Dec  2 2008, 09:26:14)<br>[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; from lxml import etree<br>Traceback (most recent call last):<br>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>  File &quot;lxml/etree.py&quot;, line 7, in &lt;module&gt;<br>    __bootstrap__()<br>
  File &quot;lxml/etree.py&quot;, line 6, in __bootstrap__<br>    imp.load_dynamic(__name__,__file__)<br>ImportError: Permission denied<br><br><br>Ok, I think I know why this is happening, so I do this:<br>$ chmod +x lxml/*.pyd<br>
$ python<br>Python 2.5.2 (r252:60911, Dec  2 2008, 09:26:14)<br>[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin<br>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.<br>
&gt;&gt;&gt; from lxml import etree<br>Segmentation fault (core dumped)<br><br>Ok, so that didn&#39;t work.<br><br>The next thing I tried was the instructions found here: <a href="http://www.scribd.com/doc/16158375/LXML-221-documentation">http://www.scribd.com/doc/16158375/LXML-221-documentation</a> in section 23.7 - &quot;Static linking on Windows&quot;.<br>
I downloaded the latest versions of iconv, libxml2, libxslt, zlib and lxml-2.2.1.tar.gz.  I unpacked them as per the instructions and edited lxml-2.2.1/setup.py to fix the STATIC_INCLUDE_DIRS and STATIC_LIBRARY_DIRS to point back to those newly extracted libraries. Now I run:<br>
<br>$ cd lxml-2.2.1<br>$ python setup.py bdist_wininst --static<br>Building lxml version 2.2.1.<br>NOTE: Trying to build without Cython, pre-generated &#39;src/lxml/lxml.etree.c&#39; needs to be available.<br>ERROR: /bin/sh: xslt-config: command not found<br>
<br>** make sure the development packages of libxml2 and libxslt are installed **<br><br>Using build configuration of libxslt<br>Building against libxml2/libxslt in one of the following directories:<br>  ..\libxml2-2.7.3.win32\lib<br>
  ..\libxslt-1.1.24.win32\lib<br>  ..\zlib-1.2.3.win32\lib<br>  ..\iconv-1.9.2.win32\lib<br>running bdist_wininst<br>error: distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform<br>
<br>So I figure this is because I&#39;m trying to build inside Cygwin. I tried inside a cmd.exe window, and it gets a bit further but then complains about not having VisualC++2003 installed... I tried -c mingw32 but setup.py didn&#39;t understand that option. Seemed like a dead end. I think it might be picking up my ActiveState Python installation too, rather than the Cygwin one.<br>
<br>I also tried the actual versions of libxml, libxslt etc that the document actually mentions, same result.<br><br>Anyway, my understanding is that all this should be unnecessary - the .egg should contain everything I need, shouldn&#39;t it? But the segmentation fault at import time is bad.<br>
<br>I&#39;d really like to use lxml in Cygwin if possible, because all the other options for xpath processing seem very limited. I like the idea of the egg because I want to be able to deploy my XML-processing python scripts with the .egg, so that I don&#39;t need to install any additional software (such as Cygwin packages).<br>
<br>Any help would be greatly appreciated, please.<br><br>Regards,<br><br>-- David.<br><br><br><br><br><br><br><br>