You are not logged in.

#1 2019-12-21 21:28:27

capstayn
Member
Registered: 2017-11-25
Posts: 7

[SOLVED] python-numpy only works with openblas

For an OpenCV installation, I want to use atlas as BLAS implementation. There is not atlas package for BLAS on the official repositories, so I installed it from AUR (atlas-lapack).

I also installed python-numpy from the official repositories. I could have installed it with pip or anaconda but the archwiki recomends otherwise.

With this setup, I installed opencv from source, with Atlas for BLAS implementation and python3.8 bindings. However, `import cv2` failed with this error:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "cv2/__init__.py", line 8, in <module>
   import numpy
   File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 145, in <module>
   from . import lib
   File "/usr/lib/python2.7/site-packages/numpy/lib/__init__.py", line 9, in <module>
   from .index_tricks import *
   File "/usr/lib/python2.7/site-packages/numpy/lib/index_tricks.py", line 13, in <module>
   import numpy.matrixlib as matrixlib
   File "/usr/lib/python2.7/site-packages/numpy/matrixlib/__init__.py", line 6, in <module>
   from .defmatrix import *
   File "/usr/lib/python2.7/site-packages/numpy/matrixlib/defmatrix.py", line 13, in <module>
   from numpy.linalg import matrix_power
   File "/usr/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 51, in <module>
   from .linalg import *
   File "/usr/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 35, in <module>
   from numpy.linalg import lapack_lite, _umath_linalg
ImportError: libopenblas.so.3: cannot open shared object file: No such file or directory

From this log I infer that numpy requires openblas. This requirement is not possible to fulfil because it would conflict with atlas. So I am forced either to remove atlas and use openblas or install numpy with anaconda, which is discouraged by the wiki.

IMHO one of these things should be done:
- Allow python-numpy package to link against atlas library if it is available
- Create a python-numpy package that links agains atlas library
- Change the text in the python packaging guideline so that it encourages pip or anaconda as python packages managers.

Maybe the three of them :)

Perhaps I'm missing something, could anyone give me a hand?

Last edited by capstayn (2019-12-22 09:42:14)

Offline

#2 2019-12-21 23:40:31

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 1,717

Re: [SOLVED] python-numpy only works with openblas

No, numpy doesn't depend on openblas. In fact, there is nothing in our repos that links to libopenblas.so.3, so this dependency comes from something you have installed from outside the official repos. Running 'lddtree /usr/lib/python2.7/site-packages/numpy/linalg/lapack_lite.so' may give you some hint.

Offline

#3 2019-12-22 09:34:32

capstayn
Member
Registered: 2017-11-25
Posts: 7

Re: [SOLVED] python-numpy only works with openblas

Yep, you are right. The error seems to come from atlas-lapack. Thanks for the tip.

Offline

Board footer

Powered by FluxBB