My Python application required lxml. When I tried installing lxml, it the a "vcvrsall.bat not found" error. After digging around on the interwebs, I found that I needed to install MinGW, add it to my PATH variable and modify the distutils.cfg to use this compiler. It worked to the point that it now tried to download the lxml sources and compile it but fails on an error that reads fatal error: libxml/xmlversion.h: No such file or directory. It seems that lxml in turn depends on the libxml C library. How can I install this C library into my MinGW environment so that I can continue building my lxml.
Thanks.
It seems that lxml in turn depends on the libxml C library.
lxml is a python wrapper for the libxml C library.
How can I install this C library into my MinGW environment so that I can continue building my lxml.
Try this tutorial: http://www.pokorra.de/coding/compile_libxml_mingw.html
For lxml, you have to include references to the libxml headers and also have to link against the binaries.
you can download Unofficial Windows Binaries at:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
e.g. for python 2.7 32bit:
http://www.lfd.uci.edu/~gohlke/pythonlibs/3i67tivk/lxml-2.3.3.win32-py2.7.exe
Related
I am trying to install lxml for my project which is based on Python 3.12 for testing reasons. The problem is related to building the wheel for lxml.
I am still getting:
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
I am using Windows 11 and was trying different approaches:
Putlibxml2.dll in C:\Windows
Put libxml2.dll in C:\Windows\SysWOW64
Put libxml2.dll in another folder and add this folder to Path
Search the internet but the solutions I found are all related to Linux
I am trying to do some web scraping using python with PyCharm on a windows 10 machine. Some sites suggest using lxml library and it sounds good. I am trying to load the package but am having trouble. What should I do?
OK great. I go to add lxml 3.6.4 in the package installer and it fails with the message(s):
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
and
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
I installed libxml2dom via the package installer but that does not do the trick
xslt-config is not one of the available packages in the available packages installer
libxml2 is also not an available package
I do not see "libxml2" from the options of available packages. But I do see "libxml2-python" 2.6.21
I tried to install it, but it fails with the message:
Collecting libxml2-python==2.6.21
Could not find a version that satisfies the requirement libxml2-python==2.6.21 (from versions: )
No matching distribution found for libxml2-python==2.6.21
I have been able to load other packages
Using python interpreter 3.5.2
Using PyCharm Community Edition 2016.2.3
lxml needs C/C++ libraries libxml, libxstl so you have to install it first. But they are not Python modules but standard libraries - probably libxml.dll, libxstl.dll.
lxml may need also source code for this libraries or C/C++ header files *.h and C/C++ compiler to compile lxml
For Windows exists Unofficial Windows Binaries for Python Extension Packages with precompiled modules and there is lxml
But much easier (for Windows user) is use Anaconda distribution which installs the same Python from Python.org but with extra, precompiled modules like lxml. See list of modules.
PyCharm can use different Python with different project so you can have installed current Python and Anaconda and use them both in PyCharm.
I have a working setup of lxml.etree working on my windows desktop.
Since I wanted to move this to my server, instead of installing lxml in sitepackages, I wanted to install it inside the modules directly, so this lxml version is specific to this applicaion/site.
I copied my lxml directory directly under modules on the linux server, and I got this error :
No module named etree
So it seems it understood there is an lxml, package but couldn't see etree inside it.
Any ideas ?
Also, I couldn't find exactly where I can download the binaries for ubuntu 9.10 on the site : http://lxml.de/installation.html#installation
You can't just copy the Windows version over to a Linux server; lxml uses C extensions which need to be compiled for the target platform.
The etree module is such a compiled extension, on Linux that'd be etree.so, while on Windows it would be a etree.dll file instead, for example.
For Ubuntu, look for python-lxml, or install the dependencies libxml2-dev, libxslt1-dev and python-dev, plus python-pip, then use sudo pip install lxml to install lxml on your server.
I have Python 2.7 running on Windows XP. I am trying to install Spynner as an alternative to Mechanize that supports Javascript. When I run easy_install spynner, I get an error while installing lxml:
Make sure the development packages of libxml2 and libxlst are installed
Where can I find those files? I found instructions for linux but no instructions for Windows. I also tried easy_install but it could not find the packages.
Since you are running Windows, try installing lxml from a precompiled binary package. pypi.python.org hosts a binary that you could use. The next run of easy_install should detect the new lxml distribution and the installation should work.
I have installed lxml which was built using a standalone version of libxml2. Reason for this was that the lxml needed a later version of libxml2 than what was currently installed.
When I use the lxml module how do I tell it (python) where to find the correct version of the libxml2 shared library?
Assuming you're talking about a .so file, it's not up to Python to find it -- it's up to the operating system's dynamic library loaded. For Linux, for example, LD_LIBRARY_PATH is the environment variable you need to set.