I have been trying to use pip install
to install the cython
and lxml
packages under Python3.8 on Cygwin. However, this repeatedly fails with incomprehensible errors ranging from python errors to gcc header files not found, even though they are there.
Because lxml
depends on Cython
, we need to make sure we have that working first. Unfortunately Cygwin's python3.8 doesn't yet support cython, it seems. So we are told to download and use the wheel from here.
pip install Cython-0.29.13-cp38-cp38-win32.whl
# This fails with:
#ERROR: Cython-0.29.13-cp38-cp38-win32.whl is not a supported wheel on this platform.
# Instead use:
pip install Cython --install-option="--no-cython-compile"
# OK!
Now let's try to install the lxml
package.
pip install lxml
# FAIL
STATIC_DEPS=true pip3 install lxml
# FAIL
Let's check that Python.h
exists:
# find /usr/include -type f -name "Python.h"
/usr/include/python2.7/Python.h
/usr/include/python3.6m/Python.h
/usr/include/python3.8/Python.h
Ok...
So what is the problem?
Related Issues:
The only thing that seemed to work, is downloading the sources and install from there. The procedure is this:
git clone https://github.com/lxml/lxml.git lxml
cd lxml
python3.8 setup.py install
pip-date |grep lxml
# lxml 2019-10-15 16:12:05 4.5.0a0 egg sdist sys
pip list |grep lxml
# lxml 4.5.0a0
It is also possible that the reason compilation fails, is because there are several gcc compilers installed. So although I have not tested this yet, you may need to specify which compiler the (python?) environment should use.
First find what compilers are in your path:
# ls -1 /usr/bin/*gcc.exe
/usr/bin/gcc.exe
/usr/bin/i686-w64-mingw32-gcc.exe
/usr/bin/x86_64-pc-cygwin-gcc.exe
/usr/bin/x86_64-w64-mingw32-gcc.exe
Then try to export the right one to the CC
environment variable with (for example):
export CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
Now test the pip install xxx
again and see if it helped. If it did, add the above line to your ~/.bashrc
file.