explosion/cython-blis

Installing blis - from source - fails on Debian 10

bastbnl opened this issue · 3 comments

Hi,

I'm trying to upgrade to spacy-2.3.4 on my Debian 10 development machine and I run into this error:

bastb@bastb-vps:/var/tmp/pip-blis$ gcc -c blis/blis/_src/ref_kernels/1/bli_addv_ref.c -o /var/tmp/tmpc2h_9imn/bli_addv_zen2_ref.o -O3 -fomit-frame-pointer -mavx2 -mfpmath=sse -mfma -funsafe-math-optimizations -ffp-contract=fast -march=znver2 -fPIC -std=c99 -fopenmp-simd -fvisibility=hidden -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.7.0" -DBLIS_CNAME=zen2 -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/var/tmp/pip-install-viddvuxz/blis/blis/_src/include/linux-x86_64
cc1: error: bad value (‘znver2’) for ‘-march=’ switch
cc1: note: valid arguments to ‘-march=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server bonnell atom silvermont slm knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 native; did you mean ‘znver1’?

The build is selecting blis-0.7.3.tar.gz

Some details concerning the deployment:

bastb@bastb-vps:/var/tmp/pip-blis$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bastb@bastb-vps:/var/tmp/pip-blis$ cat /etc/debian_version
10.6

bastb@bastb-vps:/var/tmp/pip-blis$ uname -a
Linux bastb-vps 4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux

Any way I can specify -march=znver1 from the command line?

To double-check: you just want to install it to use spacy or you really want to compile it from source on purpose? What versions of python and pip are you using?

It looks like your system might be old enough that you have python 3.5 by default, and in that case the problem is the fact that we currently only provide binary wheels for newer releases for python 3.6+. But you can tell pip to prefer older versions with wheels instead of newer source versions:

pip install spacy==2.3.4 --prefer-binary

The older versions are missing some optimizations (blis) and some niche bug fixes (thinc), but spacy itself should work fine. If you install this way you'll still end up compiling spacy yourself in the final step, but all of spacy's dependencies should have compatible older wheels.

If you have python 3.6+, try upgrading pip first to see if it can detect the binary wheel compatibility correctly. It should be pip >=19.3. (The most recent versions should show a warning here suggesting that you upgrade pip. I see it when I forget to upgrade in a new venv since my debian system with python 3.7 has pip 18.1 by default.)

If you don't mind waiting a while for everything to compile and you'd like the most recent version of everything, I think this should work with python 3.5 and gcc 8 as long as you've upgraded pip:

BLIS_ARCH="generic" pip install spacy

Matt's the one who handles this so I'm not as familiar with all the details, but I know that v0.7.x is set up using manylinux2014 instead of manylinux1 so that there can be more recent architecture-specific optimizations, but the resulting files assume that you have gcc 9. So if you want to compile without BLIS_ARCH="generic" you'll need gcc 9.

Thanks for getting back. For context, I was trying to install spacy using --no-binary :all: and here are some details concerning the environment:

(env) bastb@bastb-vps:/var/www/brownpapersession/dev/brownpapersession$ pip --version
pip 20.2.3 from /var/www/brwnppr/dev/env/lib/python3.7/site-packages/pip (python 3.7)
(env) bastb@bastb-vps:/var/www/brownpapersession/dev/brownpapersession$ python --version
Python 3.7.6

Your suggestion worked; building it using BLIS_ARCH=generic works! Thanks

Be aware that BLIS_ARCH=generic may make blis very slow. If speed is a factor for your task, you might want to compare the speed for spacy with the generic locally-compiled version vs. the binary wheel for the most recent version of blis.

We'll try to improve this in the future so this goes more smoothly. It would be best if it didn't require gcc 9 (I don't have gcc 9 locally, either) and having this as the default behavior when you try to install the package from source is ... sub-optimal.