PackageNotFoundError: cblas not found

40 views
Skip to first unread message

John Robson

unread,
Jul 24, 2019, 9:33:02 AM7/24/19
to sage-support
I'm using Manjaro Linux with packages:

openblas-lapack (https://aur.archlinux.org/packages/openblas-lapack/)

python-numpy-openblas (https://aur.archlinux.org/packages/python-numpy-openblas/)

python-scipy-openblas (https://aur.archlinux.org/packages/python-scipy-openblas/)

They work well in other applications, but Sage Notebook cannot find "cblas" library.


$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.8, Release Date: 2019-06-26                     │
│ Using Python 2.7.16. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py:726: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
  warn("Attempting to work in a virtualenv. If you encounter problems, please "
sage: notebook()
---------------------------------------------------------------------------
PackageNotFoundError                      Traceback (most recent call last)
<ipython-input-1-b5959bb24428> in <module>()
----> 1 notebook()

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3697)()
    352             True
    353         """
--> 354         return self.get_object()(*args, **kwds)
    355
    356     def __repr__(self):

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.get_object (build/cythonized/sage/misc/lazy_import.c:2362)()
    187         if likely(self._object is not None):
    188             return self._object
--> 189         return self._get_object()
    190
    191     cpdef _get_object(self):

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2599)()
    219         elif self._at_startup and not startup_guard:
    220             print('Option ``at_startup=True`` for lazy import {0} not needed anymore'.format(self._name))
--> 221         self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name)
    222         name = self._as_name
    223         if self._deprecation is not None:

/usr/lib/python2.7/site-packages/sagenb/__init__.py in <module>()
      1 # -*- coding: utf-8 -*
      2   # init
----> 3 from . import storage

/usr/lib/python2.7/site-packages/sagenb/storage/__init__.py in <module>()
      1 # -*- coding: utf-8 -*
      2
----> 3 from .filesystem_storage import FilesystemDatastore

/usr/lib/python2.7/site-packages/sagenb/storage/filesystem_storage.py in <module>()
     50
     51 from .abstract_storage import Datastore
---> 52 from sagenb.misc.misc import set_restrictive_permissions, encoded_str
     53
     54 from sage.misc.temporary_file import atomic_write

/usr/lib/python2.7/site-packages/sagenb/misc/misc.py in <module>()
    400
    401 try:
--> 402     from sage.misc.cython import cython
    403 except ImportError:
    404     @stub

/usr/lib/python2.7/site-packages/sage/misc/cython.py in <module>()
     39
     40 # CBLAS can be one of multiple implementations
---> 41 cblas_pc = pkgconfig.parse('cblas')
     42 cblas_libs = list(cblas_pc['libraries'])
     43 cblas_library_dirs = list(cblas_pc['library_dirs'])

/usr/lib/python2.7/site-packages/pkgconfig/pkgconfig.pyc in parse(packages, static)
    246     """
    247     for package in packages.split():
--> 248         _raise_if_not_exists(package)
    249
    250     out = _query(packages, *_build_options('--cflags --libs', static=static))

/usr/lib/python2.7/site-packages/pkgconfig/pkgconfig.pyc in _raise_if_not_exists(package)
    101 def _raise_if_not_exists(package):
    102     if not exists(package):
--> 103         raise PackageNotFoundError(package)
    104
    105

PackageNotFoundError: cblas not found
sage:

$ locate cblas
/usr/include/cblas.h
/usr/include/gsl/gsl_cblas.h
/usr/lib/libcblas.so
/usr/lib/libcblas.so.3
/usr/lib/libcblas.so.3.8.0
/usr/lib/libgslcblas.so
/usr/lib/libgslcblas.so.0
/usr/lib/libgslcblas.so.0.0.0


$ ls -lha /usr/lib/libcblas.so*
lrwxrwxrwx 1 root root 14 Jul 23 23:04 /usr/lib/libcblas.so -> libopenblas.so
lrwxrwxrwx 1 root root 14 Jul 23 23:04 /usr/lib/libcblas.so.3 -> libopenblas.so
lrwxrwxrwx 1 root root 14 Jul 23 23:04 /usr/lib/libcblas.so.3.8.0 -> libopenblas.so

$ ls -lha /usr/lib/libopenblas.so*
lrwxrwxrwx 1 root root 30 Jul 23 23:04 /usr/lib/libopenblas.so -> libopenblas_haswellp-r0.3.6.so
lrwxrwxrwx 1 root root 30 Jul 23 23:04 /usr/lib/libopenblas.so.3 -> libopenblas_haswellp-r0.3.6.so

$ ls -lha /usr/lib/libopenblas_haswellp-r0.3.6.so*
-rwxr-xr-x 1 root root 14M Jul 23 23:04 /usr/lib/libopenblas_haswellp-r0.3.6.so

$ ls -lha /usr/lib/libgslcblas.so*
lrwxrwxrwx 1 root root   20 Jun 14  2018 /usr/lib/libgslcblas.so -> libgslcblas.so.0.0.0
lrwxrwxrwx 1 root root   20 Jun 14  2018 /usr/lib/libgslcblas.so.0 -> libgslcblas.so.0.0.0
-rwxr-xr-x 1 root root 250K Jun 14  2018 /usr/lib/libgslcblas.so.0.0.0

How can I inform to sage to use the cblas from openblas-lapack?

Thank you,
John

Antonio Rojas

unread,
Jul 24, 2019, 10:20:38 AM7/24/19
to sage-support


El miércoles, 24 de julio de 2019, 15:33:02 (UTC+2), John Robson escribió:

How can I inform to sage to use the cblas from openblas-lapack?


You need to provide a cblas.pc file in /usr/lib/pkgconfig/ so that pkgconfig can detect the library. Something like

libdir=/usr/lib
includedir
=/usr/include

Name: CBLAS
Description: C Standard Interface to BLAS Basic Linear Algebra Subprograms
Version: 3.8.0
URL
: http://www.netlib.org/blas/#_cblas
Libs: -L${libdir} -lcblas
Cflags: -I${includedir}
Requires.private: blas

 

John Robson

unread,
Jul 24, 2019, 12:10:09 PM7/24/19
to sage-support
WORKED Perfectly.

Antonio, Thank You Very Much!!!
Reply all
Reply to author
Forward
0 new messages