Debugging Installing LXML for Python 2.x on Windows - python

I have absolutely no experience programming Python, but I'm trying to set up some modules to implement this project, and am seriously struggling with lxml. I've hunted through a lot of help forums trying to figure out how to go about getting lxml set up, and none of the solutions have helped so far.
Things I've tried:
Downloading the lxml file from this website. I'm running Python 2.7.9, and have tried using both cp27 files from that website. Both give me the same message:
lxml-4.3.3-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.
After more hunting, it seemed like the command:
python -m pip install lxml
should be a viable alternative. However, this leads to these error messages (not the full output for space conservation, but this struck me as the relevant parts) :
c:\users\aeon~1.wil\appdata\local\temp\xmlXPathInityhhfkk.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'C:\\Users\\aeon.williams\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
I downloaded the libxml2 wheel from here, and ran the ...cp27-none-win32.whl successfully. I tried to run python -m pip install lxml again after this, but still got the same error message.
I'm sure I'm struggling because of how little I understand Python modules and pip, but I'm not exactly sure what direction to go in now to try to get lxml working on my computer. If anyone has any suggestions, please let me know!

Related

Cannot install lxml

When I'm trying to install lxml just like pip install lxml I'm getting an error " Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?".
I found a similar issue Getting "Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?" when installing lxml through pip, but when I'm trying to solve the problem following that advice I'm getting another error lxml-4.5.2-cp38-cp38-win_amd64.whl is not a supported wheel on this platform. The path to the wheel is D:\whl\lxml-4.5.2-cp38-cp38-win_amd64.whl
Using Python 3.8.1 under Windows 10 x64
I`ve solved the problem!
The error occurred in PyCharm editor. Then I tried to install lxml in VS Code editor and it was done successfully. IDK why the problem occurred, but after reinstalling PyCharm everything was OK
BTW if reinstalling didn't help, try to follow advice by Ethan in the comments

Error during boost and dlib installation for Python 3.6

I am struggling to install dlib for Python 3.6 on Windows 10. I've installed and built boost, added ...\boost_1_63_0 folder along with ...\boost_1_63_0\stage\lib folder to the PATH.
But I still have the following message
LINK : fatal error LNK1104: cannot open file 'python36.lib' [C:\Users\admin\dlib\tools\python\build\dlib_.vcxproj]
19 Warning(s)
1 Error(s)
Time Elapsed 00:05:03.17
error: cmake build failed!
when I try to type python setup.py install in command prompt.
Also, I have LINK : fatal error LNK1104: cannot open file 'libboost_python-vc140-mt-s-1_63.lib' message, when I try to install dlib through pip install dlib.
Please, help me! Otherwise, I'm feeling desperate right now after all those hours of searching for a valid solution.
After all those wasted hours of search, I have finally fixed this problem. So I will just leave the way that worked for me, so people who will face the same problem in future could find it.
The reason for such an error was that dlib's latest version doesn't support Python 3.6, which I have never noticed anywhere except this page.
The solution for problem was to install Python 3.5 and to add C:\..\Python35\libs, C:\..\Python35\include, C:\..\Python35, C:\..\Python35\Scripts paths to Windows system PATH.

lxml runs in interpreter but not through apache/mod_wsgi

I have a django app that requires Python (3.4) lxml package. I had a fair amount of trouble building the c shared libraries libxslt and libxml2 that lxml depends on in my red hat server environment. However, pip install lxml now completes successfully and I can import and use lxml in the command line interpreter.
When I restart apache, importing lxml within my django app causes the error:
ImportError: /usr/local/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: exsltMathXpathCtxtRegister
I have checked that my LD_LIBRARY_PATH is set the same in both environments (/usr/lib).
I notice that when I reinstall lxml through pip, pip tells me that it is building against libxml2/libxslt found at /usr/lib64. I have removed all libxml2.so and libxslt.so files found at /usr/lib64/ and been confounded to find that pip continues to tell me that it is building against lib64, that the install completes successfully, and that lxml still works correctly at command line but not through apache.
pip also says that the detected version of libxslt that it's using in the install is 1.1.23. However, I've used strace to see that when I import using the interpreter, the library that is loaded is /usr/lib/libxslt.so.1.1.28. I don't know of any tool or technique to find out what library is being loaded through apache..
Does anyone have any theories as to what is going on or how to debug the issue? Thanks in advance!
Fixed by removing libexslt.so files from usr/lib64/.

Can't intall lxml, using Enthought Canopy, it wants VBS 2008

Preface: I'm pretty new to CLI and Python, know nearly nothing about Canopy, and haven't been able to search my way out of this problem.
Trying to install lxml (required for a class assignment) via pip, and Canopy errors saying it can't find the xslt-config command, but continues. Later it really chokes/locks on error of not finding Visual Studio 2008, but offers 'Try MinGW as a work around'. Their suggested command returns a 'can't find setup.py' error, and I can't figure out where MinGW is located to \look in that directory.
TL;DR - lxml install seems to fail due to xslt-config problem, b/c Canopy wants Visual Studio 2008 after that. Please help me get lxml working.
Initial chunk of the terminal response follows:
Downloading lxml-3.3.5.tar.gz (3.5Mb): 3.5Mb downloaded
Running setup.py egg_info for package lxml
Building lxml version 3.3.5.
Building without Cython.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.
* make sure the development packages of libxml2 and libxslt are installed *
The code goes thru that a couple times/variations, then continues and copies a number of things until it gets to this chunk:
running build_ext
building 'lxml.etree' extension
C:\Users\Owninator\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.4.0.193
8.win-x86\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: '
bugtrack_url'
warnings.warn(msg)
error: Could not find Visual Studio 2008 in your path.
It offers
To use the MinGW compiler to build an extension module, use
the '-c' flag, e.g.:
python setup.py build_ext -c mingw64
However, when I install MinGW and use that command, I get an error that it can't find setup.py.
By far the easiest way to install lxml in Canopy is to use the package manager. It is accessible from the welcome screen, or from the Tools > Package manager menu entry. Make sure you have "Available packages" selected on the menu to the left of the package manager and in the search box, type lxml. It will give you a little button to install it.

install lxml package. I am using python 2.7.5 in windows 7

i want to install lxml package. I am using python 2.7.5 in windows 7. I am using mingw compiler. After searching through the answers in stackoverflow and other sites, I removed the problem of "unable to find vcvarsall.bat". But now the problem which is coming is it is showing a fatal error: libxml/xmlversion.h: No such file or directory. And then it is showing an error: command 'gcc' failed with exit status 1
The best way to do this is to download it form this, website. It provides some unofficial binaries. Chose the right python version and install.

Categories