Numpy is a great software package for doing numeric computations in Python. If set up right (i.e. using OpenBLAS), I’ve found it can be even faster than MATLAB’s highly optimized ATLAS backend. Unfortunately, if installed naïvely using pip
, it can be very slow. Even installing it using sudo apt-get install python-numpy
(on Ubuntu) is not as good as the following setup in my experience.
Here I will tell you how to set up Numpy and OpenBLAS on an Ubuntu machine from source (though I think they should be pretty transferable to any flavour of Linux). These instructions are based on the very useful blog post that can be found on odsf’s blog.
Before we begin
First, make sure you have these tools installed
sudo apt-get install git python-dev gfortran
Also, it might make things easier to make sure that the other Fortran compiler, g77
, is not installed (though if you prefer to keep it around, you just have to take an extra step in the Numpy install).
OpenBLAS
The first step is to install OpenBLAS. This can be done via apt-get
, but installing from source has the advantages that OpenBLAS will be fully optimized to your machine, and you can put it somewhere other than /usr/lib
(which should hopefully allow Octave to be installed simultaneously, though I haven’t tried this yet).
To install OpenBLAS, do the following commands
cd ~/src git clone https://github.com/xianyi/OpenBLAS cd OpenBLAS make FC=gfortran sudo make PREFIX=/opt/openblas install
As you can see, I prefer to put my OpenBLAS install in /opt
, so it’s out of the way of things I install with apt-get
.
Finally, you have to let your system know about these new libraries. Add a file to /etc/ld.so.conf.d/
called openblas.conf
, containing the path to your new libraries (/opt/openblas/lib
). Then run sudo ldconfig
.
Numpy
Building Numpy requires Cython, so make sure it is installed (pip install cython
, with sudo
or --user
as necessary depending on where you want to install it).
Next, we install Numpy
cd ~/src git clone https://github.com/numpy/numpy cd ~/numpy
By default, the repository will be on the current development (master
) branch. I prefer to use the latest stable branch. To find this, type git checkout v
and press Tab. This should show you all the possible branches. Find the newest branch (largest version number) with no letters after it (indicating a full release). Right now it’s v1.10.4
:
git checkout v1.10.4
Add a file called site.cfg
, with the following lines
[default] include_dirs = /opt/openblas/include library_dirs = /opt/openblas/lib [openblas] openblas_libs = openblas library_dirs = /opt/openblas/lib [lapack] lapack_libs = openblas library_dirs = /opt/openblas/lib
This file lets Numpy know where your OpenBLAS libraries are. Run python setup.py config
to make sure everything is set up correctly. You should see no mention of ATLAS. (TODO: I should try this with ATLAS installed, to see if Numpy ignores it or tries to use it.) If everything looks good, go ahead and call python setup.py build
. If you have both Fortran compilers installed, call:
python setup.py build --fcompiler=gnu95
to specify gfortran
as the compiler (see Numpy install notes).
One of the benefits of using OpenBLAS is that it can make Numpy’s dot
function for matrix-matrix multiplies really fast. For this to work, Numpy needs the file core/_dotblas.so
to exist. In your Numpy source directory (where you should still be if you’re following along), look under build/lib.linux-x86_64-2.7/numpy/core
, and make sure _dotblas.so
is there. You can also run ldd
on it, to make sure that it’s finding your OpenBLAS library all right. (Update: new versions of Numpy no longer create _dotblas.so
, see below.)
If everything seems good, call python setup.py install
. Installing to a virtual environment is best. Otherwise, use the --user
flag to install to your home directory, or put the sudo
command on front to install to the /usr
directory.
To make sure everything is working right, I run the following script
import numpy as np import numpy.random as npr import time # --- Test 1 N = 1 n = 1000 A = npr.randn(n,n) B = npr.randn(n,n) t = time.time() for i in range(N): C = np.dot(A, B) td = time.time() - t print("dotted two (%d,%d) matrices in %0.1f ms" % (n, n, 1e3*td/N)) # --- Test 2 N = 100 n = 4000 A = npr.randn(n) B = npr.randn(n) t = time.time() for i in range(N): C = np.dot(A, B) td = time.time() - t print("dotted two (%d) vectors in %0.2f us" % (n, 1e6*td/N)) # --- Test 3 m,n = (2000,1000) A = npr.randn(m,n) t = time.time() [U,s,V] = np.linalg.svd(A, full_matrices=False) td = time.time() - t print("SVD of (%d,%d) matrix in %0.3f s" % (m, n, td)) # --- Test 4 n = 1500 A = npr.randn(n,n) t = time.time() w, v = np.linalg.eig(A) td = time.time() - t print("Eigendecomp of (%d,%d) matrix in %0.3f s" % (n, n, td))
And on my machine, I get these results
multiplied two (1000,1000) matrices in 49.8 ms dotted two (4000) vectors in 6.87 us SVD of (2000,1000) matrix in 1.192 s Eigendecomp of (1500,1500) matrix in 7.805 s
If just the matrix-matrix multiply is slow, it’s likely because core/_dotblas.so
didn’t get created, or can’t find your OpenBLAS library (see above). If the SVD and Eigendecomposition are slow, it’s likely that you have a problem with the LAPACK linking (this only happened when I tried to use the OpenBLAS installation from apt-get
).
Update: no _dotblas.so
in new Numpy
New versions of Numpy no longer create _dotblas.so
, so don’t worry if you don’t see it. If Numpy is finding your OpenBLAS install when you do python setup.py config
, you’re probably good.
Scipy
Scipy is easy to install, because it will make use of Numpy’s OpenBLAS bindings. Just run pip install scipy
and you should be good to go, or install normally from source to get the lastest development version.
Thank you for the post. I’ve followed every single step here, but still cannot find _dotblas.so generated under build/lib.linux-x86_64-2.7/numpy/core after trying for quite a few times. May I know if you know how to solve this problem?
Thank you.
LikeLike
What version of Linux are you running, and what version of Numpy are you trying to install? Also, what version of Python?
LikeLiked by 1 person
I’ve found that new versions of Numpy no longer create “_dotblas.so“, so don’t worry if you don’t see it.
LikeLike
On my laptop (running Linux Mint 15), I’ve found that OpenBLAS from the Mint repository (installed with apt-get) is considerably faster than the one I built from source. You can use that one by doing “sudo apt-get install libopenblas-base libopenblas-dev“, and changing the library dir in the “site.cfg“ file to be “/usr/lib/openblas-base“ and commenting out the include dir.
LikeLiked by 2 people
Note that you have to install `cython` as well using the usual `pip install cython`
LikeLike
Maybe also mention that you’re only going to see an improvement along the lines of 3 times faster if you installed numpy outside of `pip`, but a more significant improvement if you’ve installed with `pip` as `pip` can’t see the installed libraries so can’t do anything with OpenBLAS.
LikeLike
Pingback: Why does scikit-learn cause core dumped? | DL-UAT
Thank you! I’m on my way to installing gensim now! Hopefully it’ll be blazingly fast now that I have OpenBLAS!
LikeLike
Thank you so much for this. I am using Ubuntu 14.04 on VirtualBox for this and get the following results:
multiplied two (1000,1000) matrices in 602.3 ms
dotted two (4000) vectors in 25.59 us
SVD of (2000,1000) matrix in 14.974 s
Eigendecomp of (1500,1500) matrix in 49.694 s
which seem a bit slow. Do you think you could help me figure out why that could be?
LikeLike
Look at the output of `numpy.show_config()`. Is it pointing to your OpenBLAS install? Post the output here if you’re not sure.
LikeLike
This is the output (in the python interpreter):
lapack_opt_info:
libraries = [‘openblas’]
library_dirs = [‘/home/fieldsofgold/openblas/lib’]
define_macros = [(‘HAVE_CBLAS’, None)]
language = c
blas_opt_info:
libraries = [‘openblas’]
library_dirs = [‘/home/fieldsofgold/openblas/lib’]
define_macros = [(‘HAVE_CBLAS’, None)]
language = c
openblas_info:
libraries = [‘openblas’]
library_dirs = [‘/home/fieldsofgold/openblas/lib’]
define_macros = [(‘HAVE_CBLAS’, None)]
language = c
openblas_lapack_info:
libraries = [‘openblas’]
library_dirs = [‘/home/fieldsofgold/openblas/lib’]
define_macros = [(‘HAVE_CBLAS’, None)]
language = c
blas_mkl_info:
NOT AVAILABLE
LikeLike
And what’s your Numpy version?
LikeLike
>>> numpy.__version__
‘1.10.0.dev0+a92c4a1’
LikeLike
You could try using a different Numpy version (I’m using 1.9.2). Do you have a `_dotblas.so` in `numpy/core` of your install directory (find your install directory by executing `numpy.__file__` in Python). If you don’t, that could be a problem (on 1.9.2, I have it). If you have it, you can check that it’s linked properly with `ldd _dotblas.so`, which should list `libopenblas` and have it pointing to where it’s located on your machine.
LikeLike
Just checked. ‘_dotblas.so’ isn’t there in the numpy/core, would uninstalling numpy’s current version, and replacing it with 1.9.2 solve the problem ? I mean is the source of the problem definitely numpy’s current version, and not anything else going topsy-turvy?
LikeLike
I have no idea what the problem is, but my next try would be using 1.9.2, since I know on my machine that’s created a `_dotblas.so` and I know how to check that it’s linked properly. As I mentioned in an edit to my original post, I installed Numpy on my new laptop and found that newer versions don’t make `_dotblas.so`, so it might not be a problem that you don’t have it. But I don’t have that machine here, and I’m not sure what `.so` files link to `libopenblas` in newer versions; if you can figure it out, those are what you need to check are linked properly, using `ldd`.
LikeLike
I’ll try 1.9.2, and see if it solves the problem. I just looked through a similar issue on stackoverflow and tried the script mentioned over here (http://stackoverflow.com/questions/29026976/no-dotblas-so-after-installing-openblas-and-numpy#comment46344438_29037673).
It gives me this output:
version: 1.10.0.dev0+a92c4a1
maxint: 9223372036854775807
/usr/local/lib/python2.7/dist-packages/numpy/distutils/system_info.py:635: UserWarning: Specified path is invalid.
warnings.warn(‘Specified path %s is invalid.’ % d)
BLAS info:
* libraries [‘openblas’]
* library_dirs [‘/home/fieldsofgold/openblas/lib’]
* define_macros [(‘HAVE_CBLAS’, None)]
* language c
dot: 0.351207 sec
While running ‘python setup.py config’ numpy seemed to have found the openblas libraries but I got a similar warning. I am not sure if this is somehow related but just thought I would mention if it indicates anything (I am almost a complete noob). Otherwise I’ll look for any .so files that link to libopenblas. Thanks so much for your help!
LikeLike
The other thing to look at is whether OpenBLAS is using multiple threads. You can test this with the system monitor. Remember that not all OpenBLAS operations are multithreaded, but `dot` definitely is, so I’d test with that. If it doesn’t seem to be using multiple threads, you can try recompiling OpenBLAS with some other compiler options. You can also try compiling against the OpenBLAS in the package repo (`apt-get install libopenblas-base libopenblas-dev`; the installed libraries should be in `/usr/lib/openblas-base`).
Overall, your numbers aren’t unreasonable, and it’s possible that its using OpenBLAS just fine and your machine just isn’t that powerful. If you’re using virtualenvs, you can always do a naive Numpy install with `pip install numpy` in a separate virtualenv and compare the speeds. You can also benchmark against the Numpy in the package repo (the one from `apt-get install python numpy`).
LikeLike
So, I ran the test code in a local numpy installation in virtualenv and these are the results I got:
lapack_info:
NOT AVAILABLE
lapack_opt_info:
NOT AVAILABLE
openblas_lapack_info:
NOT AVAILABLE
blas_info:
NOT AVAILABLE
atlas_3_10_blas_threads_info:
NOT AVAILABLE
atlas_threads_info:
NOT AVAILABLE
blas_src_info:
NOT AVAILABLE
atlas_3_10_threads_info:
NOT AVAILABLE
atlas_blas_info:
NOT AVAILABLE
atlas_3_10_blas_info:
NOT AVAILABLE
lapack_src_info:
NOT AVAILABLE
atlas_blas_threads_info:
NOT AVAILABLE
openblas_info:
NOT AVAILABLE
blas_mkl_info:
NOT AVAILABLE
blas_opt_info:
NOT AVAILABLE
atlas_info:
NOT AVAILABLE
atlas_3_10_info:
NOT AVAILABLE
lapack_mkl_info:
NOT AVAILABLE
mkl_info:
NOT AVAILABLE
multiplied two (1000,1000) matrices in 39111.3 ms
dotted two (4000) vectors in 15.83 us
SVD of (2000,1000) matrix in 53.638 s
Eigendecomp of (1500,1500) matrix in 177.490 s
It does show a degradation in time (except for the second one), so does that mean its due to my machine specs? I have allocated only 4Gb to the linux virtual machine that I have, so perhaps that could be it?
Also, checked the number of threads while openblas was running (or potentially running) by the command: cat /proc/ PID /status, and found 8 threads.
LikeLike
Pingback: No _dotblas.so after installing OpenBLAS and Numpy - BlogoSfera
thanks!
LikeLike
Hi thanks for the detailed tutorial… 🙂
I wanted to know which processor are you using for those timings you got ?
I am using a Pentium G3220 (4th gen, Haswell) and my timings are:
multiplied two (1000,1000) matrices in 157.6 ms
dotted two (4000) vectors in 3.07 us
SVD of (2000,1000) matrix in 2.467 s
Eigendecomp of (1500,1500) matrix in 12.211 s
So are these OK or is there any problem with BLAS linking ?
LikeLike
Those numbers look okay. I ran my tests on a 4-core Intel i7-4770 @ 3.40 GHz.
LikeLike
Hi,
A very detailed and interesting explanation.
I have installed everything as explained and when I checked the numpy configuration with “python setup.py config” command, although I compiled OpenBLAS with gfotran (option: make FC=gfortran) I have the following output where it seems that OpenBLAS is not compiled with gfortran.
openblas_info:
FOUND:
libraries = [‘openblas’, ‘openblas’]
library_dirs = [‘/usr/local/openblas/lib’]
language = f77
Which could be the problem?
LikeLike
I think that’s just saying the language, not the compiler (i.e. it’s Fortran 77 standard). Mine says the same thing though I also compiled with `gfortran`, and it works fine.
LikeLike
I come back to this post one every month or so it seems! Could you add brackets to the print statements in the example script at the end of the post? I often copy this and `%paste` into IPython, which fails in Python 3.
LikeLike
Sure!
LikeLike
Thanks 🙂
LikeLike
I have got two error while i was installed OpenBLAS. I just simply follow your mentioned steps.
collect2: error: ld returned 1 exit status
make[1]: *** [../libopenblas_barcelonap-r0.2.14.so] Error 1
make[1]: Leaving directory `/home/sanjay/Downloads/OpenBLAS-0.2.14/exports’
make: *** [shared] Error 2
Any idea how to fix it.
I have also tried by using “make TARGET=BARCELONA” and “make TARGET=BARCELONA USE_OPENMP=1”
But same error.
LikeLike
Sorry, no idea. Maybe ask the OpenBLAS people? If you’re on Ubuntu or a similar system, you might be able to `apt-get` a pre-built OpenBLAS binary for your system. I think I briefly mention how to hook that up in the post.
LikeLiked by 1 person
Hi,
Thanks for your great tutorial.
I’m using anaconda (miniconda) virtual environment with python 3.4, and my system is using python2.7
When I tried to install numpy, its automatically getting installed in python2.7 path, so I couldn’t use numpy in the virtual environment.
It seems only pip install command can only be used to install python packages in virtual environment.
Hope you understood my problem.
LikeLike
If you’re doing `python setup.py install` (without `sudo`), you shouldn’t have administrative rights, so it shouldn’t be able to install it to your python2.7 (what do you mean by “python2.7 path”?). Make sure your Conda environment is active (`activate `, it should show in parentheses at the prompt).
LikeLike
Pingback: Python:Why does scikit-learn cause core dumped? – IT Sprite
Hi,
First – It’s a great post – thank you! 🙂
Second – I’m using Anaconda, and am trying to rebuild numpy to use openblas.
(I should mention that I’m not an admin on the computer).
As I follow your instruction everything works fine, until I try running:
python setup.py build
then I get the following error:
Traceback (most recent call last):
File “Anaconda/lib/python2.7/site.py”, line 548, in
main()
File “Anaconda/lib/python2.7/site.py”, line 530, in main
known_paths = addusersitepackages(known_paths)
File “Anaconda/lib/python2.7/site.py”, line 266, in addusersitepackages
user_site = getusersitepackages()
File “Anaconda/lib/python2.7/site.py”, line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File “Anaconda/lib/python2.7/site.py”, line 230, in getuserbase
from sysconfig import get_config_var
ImportError: No module named sysconfig
I understand that it has something to do with the definition of my python path between the Anaconda path ‘Anaconda/bin’ and the python libraries path ‘Anaconda/lib/python2.7’, yet I have no idea as to how to fix it.
Do you maybe understand what did I do wrong?
Thanks!
LikeLike
So there’s no `Anaconda/lib/python2.7/sysconfig.py`? From what I can tell, `sysconfig` is a fundamental Python module that should exist in all installs. Does your installation work at all? i.e. can you start up a Python shell at the command line or run a basic script? AFAIK `site.py` is imported before running any script, because it tells Python where to look for modules, among other things. So if other basic scripts do work, I’m not sure why `setup.py` would have an issue.
LikeLike
Hi, thank you for the post! All my timings are quite fast, more or less the same as yours, except that I get 11.5s for my Eigendecomp, so there could be an issue there with LAPACK. Could you give me some hints on how to to ensure that the LAPACK linking is correct, and if it is wrong, how to correct it?
Thank you
Konrad
LikeLike
Hi Konrad. To me, 11.5 s doesn’t seem that much slower than my time. It’s the same order of magnitude, which to me suggests that your LAPACK linking is fine. You can also check your SVD time, since I think LAPACK is also used for that. AFAIK, LAPACK is part of the OpenBLAS build, so I don’t think it’s easy to have the BLAS part linked without having LAPACK as well. I wouldn’t be worried. Just so you know, when BLAS and LAPACK are not linked at all, the Eigendecomposition takes on the order of 50 seconds on my machine.
If there is some problem with the LAPACK linking, I’m not sure how that would show up (i.e. how to test for it), or how to fix it. Sorry!
LikeLike
FYI don’t bother compiling if you have Linux, the Anaconda Python 3.5 version includes OpenBLAS integration in the Linux build 🙂 Still would like to know how to compile it for Python 3.5 if anyone can make the steps simple.
LikeLike
I carried out the same procedure for Python 3.5. Everything is the same, except you need to install SciPy from source using the `sites.cfg` file from the Numpy install and renaming it `site.cfg`.
LikeLike
Hi, I made all the way to the last step:
python setup.py install
The installation went through smoothly.
However, when I try the test code, I get this error:
________________________________
Traceback (most recent call last):
File “C:\Users\Devin Liu\Desktop\a.py”, line 2, in
import numpy
File “C:\everything\Python2.7.3\lib\site-packages\numpy-1.10.4-py2.7-win32.egg\numpy\__init__.py”, line 180, in
from . import add_newdocs
File “C:\everything\Python2.7.3\lib\site-packages\numpy-1.10.4-py2.7-win32.egg\numpy\add_newdocs.py”, line 13, in
from numpy.lib import add_newdoc
File “C:\everything\Python2.7.3\lib\site-packages\numpy-1.10.4-py2.7-win32.egg\numpy\lib\__init__.py”, line 8, in
from .type_check import *
File “C:\everything\Python2.7.3\lib\site-packages\numpy-1.10.4-py2.7-win32.egg\numpy\lib\type_check.py”, line 11, in
import numpy.core.numeric as _nx
File “C:\everything\Python2.7.3\lib\site-packages\numpy-1.10.4-py2.7-win32.egg\numpy\core\__init__.py”, line 14, in
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
_____________________________________
I did searching for the solution for this error, most people say it is because a 64-bit numpy is install on a 32-bit python.
I am using python2.7.3 32-bit on a 64-bit Win10 system. Both python and numpy(originally installed with pip) worked well before I try to install numpy with OpenBLAS. So, I went back to get the original numpy that worked fine. Here is how I got it. I downloaded numpy1.10.4 with:
—-pip download numpy
—-tar xf numpy-1.10.4.tar.gz
—-Copy and paste updated site.conf into the unzipped folder
Then, I did config..build…install. Again, everything went well. But I still get the same error when I run the test code, and now I am lost.
Why do I get this error and what is the next step I should try?
Thanks!
Devin
LikeLike
I don’t have any experience with 32-bit Python. You might want to post this on StackOverflow if you can’t find an answer out there already.
LikeLike
Pingback: Build numpy with LAPACK/openblas on Deepthought | BIOTRACYPHY
When I used system numpy installed usinf sudo apt-get install python-numpy I gor the following results:
dotted two (1000,1000) matrices in 255.2 ms
dotted two (4000) vectors in 5.77 us
SVD of (2000,1000) matrix in 3.476 s
Eigendecomp of (1500,1500) matrix in 13.271 s
When I removed system numpy and installed from github with openBLAS I got the following results:
dotted two (1000,1000) matrices in 167.9 ms
dotted two (4000) vectors in 6.85 us
SVD of (2000,1000) matrix in 2.860 s
Eigendecomp of (1500,1500) matrix in 26.969 s
Difference is rather poor and eigendecomp is slower. Are you sure in file site.cfg I should put everywhere openblas even for lapack and default?
LikeLike
All I can tell you is what worked for me on my machine, and that’s what’s above. One thing you can check is what BLAS is `python-numpy` using (run `numpy.show_config()` in a Python shell)? You’re getting a reasonable boost in everything except the eigendecomposition, so maybe something is wrong with the LAPACK build when you build OpenBLAS? You could try running the tests. I really have no idea, though.
LikeLike
Thank you for your reply @erichuns. I got around this problem and installed openblas from linux mint repos. I needed to remove atlas though due to some conflict with atlas_lapack. It seems to be working fine now.
LikeLike
Thanks, man! This is exactly what I needed to get over my missing cblas woes.
LikeLike
Are np.dot and np.linal.svd supposed to be multicore functions after following these instructions?
LikeLike
The short answer is yes. The long answer is it depends on how OpenBLAS is set up (but following the above instructions should have it be multi-threaded by default, at least in my experience). There is an OpenBLAS flag you can play around with, see here (though note that those are ways to make it single-threaded if it’s not, so you’d want to try setting those numbers higher than 1. But really you shouldn’t need to, it should be multi-threaded by default.)
LikeLike
Thanks for sharing,but I am stuck in the step of
make FC=gfortran
and the error message is as below :
==============================
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make[1]: *** [../libopenblas_sandybridgep-r0.2.20.dev.so] Error 1
make[1]: Leaving directory `/home/chingwei/Downloads/OpenBLAS/exports’
make: *** [shared] Error 2
===============================
Do you know how to solve the problem?
I already have libgfortran in /usr/lib/
thanks so much
LikeLike
Try `ldconfig -v | grep gfortran` to see if `ld` is picking it up. If it’s not (which seems to be the case), you’ll need to figure out why. One workaround would be to find where the library is (`locate libgfortran`) and add that directory to a file in `/etc/ld.so.conf.d/`, and run `sudo ldconfig`.
LikeLike
Pingback: PyCuda and GPU computing experiments | Madness in Data Science
Hello!
When you say “cd ~/src”, I am not able to find in my system(Ubuntu), Did you mean usr/src ?
LikeLike
I just made a
src
directory in my home folder. You can do the same (cd ~; mkdir src
), or just put the source code wherever is convenient for you.LikeLike
Great thanks!
For the first time nothing speeded up. While trying for second time i mentioned that after “pip uninstall numpy” “import numpy” comand in python is valid. So numpy was not deleted and that is why not correctly installed (in my case). After manual deleting numpy in python folder and reinstall everything worked!
LikeLike
Yes, it is possible to have multiple Numpy installations at the same time. I usually keep doing “pip uninstall numpy“ (with “sudo“ if necessary) until they’re all removed. You can always check which install is being used with “python -c “import numpy; print(numpy.__file__)”“.
LikeLiked by 1 person
Hello,
Thank you for this post! However I am running code on my lab’s server where I don’t have right to apt-get install libraries. What I do is to create an anaconda environment and install things inside. But I don’t see how I can install libopenblas-dev this way. Can you please give me some tips? Thank you in advance!
PS: I want to install it because I installed scikit-learn without error, then when I run it, I complains:
>>> from sklearn.linear_model import Ridge, RidgeClassifier, LogisticRegression
Traceback (most recent call last):
File “”, line 1, in
File “/users/ao/lsun/anaconda2/envs/Codalab_mimic/lib/python2.7/site-packages/sklearn/linear_model/__init__.py”, line 15, in
from .least_angle import (Lars, LassoLars, lars_path, LarsCV, LassoLarsCV,
File “/users/ao/lsun/anaconda2/envs/Codalab_mimic/lib/python2.7/site-packages/sklearn/linear_model/least_angle.py”, line 24, in
from ..utils import arrayfuncs, as_float_array, check_X_y
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory
So I think I need to install libopenblas.
Best regards,
LilyS
LikeLike
You can install OpenBLAS from source, as I describe above. When you call “make“, set the PREFIX to a directory that you own (maybe “~/opt/openblas“ or something like that). You’re not going to be able to call “ldconfig“, so you’ll need to add the directory where the OpenBLAS libs are to “LD_LIBRARY_PATH“
(see http://stackoverflow.com/questions/17689528/update-ldconfig-cache-without-root-permission). Just make sure you use the directory to your OpenBLAS libraries (e.g. “/home/lilys/opt/openblas/lib“, assuming “lilys“ is your username) instead of “/opt/openblas/lib“ everywhere it appears in the above instructions.
LikeLike
Pingback: Compiling numpy with OpenBLAS integration - iZZiSwift