scikit-learn: CBLAS not present but scikit does not add the local copy

My installation with pip fails because CBLAS is not present, even though ATLAS is present and the scipy pip installation worked.

The error is:

error: Command "g++ -pthread -shared build/temp.linux-x86_64-3.5/sklearn/svm/liblinear.o build/temp.linux-x86_64-3.5/sklearn/svm/src/liblinear/linear.o build/temp.linux-x86_64-3.5/sklearn/svm/src/liblinear/tron.o -L/usr/lib64/atlas -Lbuild/temp.linux-x86_64-3.5 -lcblas -lm -o build/lib.linux-x86_64-3.5/sklearn/svm/liblinear.cpython-35m-x86_64-linux-gnu.so" failed with exit status 1
/usr/bin/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status

When checking the get_info, I see:

get_info(‘blas_opt’, 0) /local/workspace/master-thesis-2015/flickr-crawl/env/lib/python3.5/site-packages/numpy/distutils/system_info.py:635: UserWarning: Specified path is invalid. warnings.warn(‘Specified path %s is invalid.’ % d) {‘language’: ‘c’, ‘library_dirs’: [‘/usr/lib64/atlas’], ‘define_macros’: [(‘HAVE_CBLAS’, None), (‘NO_ATLAS_INFO’, -1)], ‘include_dirs’: [‘/usr/include’], ‘libraries’: [‘tatlas’]}

Which indicates that NO_ATLAS_INFO is -1 so scikit-learn doesn’t add its own CBLAS implementation but HAVE_CBLAS, None is indicating that it should.

Changing line 64 in sklearn/setup.py to

    if (not blas_info) or (
            ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', [])) or (
            ('HAVE_CBLAS', None) in blas_info.get('define_macros', [])):

fixes the problem. HAVE_CBLAS was only added in the latest numpy 1.10.1.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

That would still leave the issue when building against numpy 1.10.0 - 1.11.1. So a fix in scikit-learn (which is pretty simple) would still be good.