Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install lxml fails on python 3.7 on windows

Today I installed python 3.7 on my windows 10 machine, and most things seem to be working, but when I try to run pip install lxml the install fails. Rather than finding an appropriate precompiled wheel, it appears to be downloading the source package, running setup.py bdist_wheel which in turn calls out to visual studio to try to build a C/C++ extension and that fails with:

Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?

I believe the real question is why it needs to do this recompile in the first place. If I setup a virtual environment with python 3.6.6 on the same machine, pip install lxml downloads and installs the precompiled wheel just fine.

PyPI seems to have wheels for the lxml on 3.7 on windows, but maybe the platform names aren't matching properly or something. python -V -V on my machine returns:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
like image 988
simmdan Avatar asked Jun 30 '18 20:06

simmdan


People also ask

How do I import lxml into Python?

Type “ pip install lxml ” (without quotes) in the command line and hit Enter again. This installs lxml for your default Python installation. The previous command may not work if you have both Python versions 2 and 3 on your computer. In this case, try "pip3 install lxml" or “ python -m pip install lxml “.

Why can't I install pip in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.


1 Answers

Of course, as soon as I post the question I discover the answer. I thougt PyPI had a precompiled build for python 3.7 on windows, but when I tried to manually download and install I discovered that I read the version number I was looking at incorrectly (it was for python 2.7). When I looked down the list to python 3.7, I discovered that they currently only have posted a precompiled build for linux.

This site, however, does have a precompiled version for python 3.7 on windows. When I downloaded that, it installed just fine.

like image 121
simmdan Avatar answered Sep 28 '22 03:09

simmdan