Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import numpy: Error: /usr/lib/liblapack.so.3: undefined symbol: gotoblas

When I try to import numpy, I get the following error:

/usr/local/lib/python2.7/dist-packages/numpy/linalg/__init__.py in <module>()
     49 from .info import __doc__
     50 
---> 51 from .linalg import *
     52 
     53 from numpy.testing import Tester

/usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.py in <module>()
     27     )
     28 from numpy.lib import triu, asfarray
---> 29 from numpy.linalg import lapack_lite, _umath_linalg
     30 from numpy.matrixlib.defmatrix import matrix_power
     31 from numpy.compat import asbytes

ImportError: /usr/lib/liblapack.so.3: undefined symbol: gotoblas

I have already tried solutions posted Error by import numpy: lapack_lite.so: undefined symbol and GotoBLAS error when installing matplotlib with pip in a virtualenv on debian wheezy

I already tried all the options in:

vvkulkarni@galileo:~$ sudo update-alternatives --config liblapack.so.3
There are 3 choices for the alternative liblapack.so.3 (providing /usr/lib/liblapack.so.3).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/openblas-base/liblapack.so.3      40        auto mode
  1            /usr/lib/atlas-base/atlas/liblapack.so.3   35        manual mode
  2            /usr/lib/lapack/liblapack.so.3             10        manual mode
  3            /usr/lib/openblas-base/liblapack.so.3      40        manual mode

I am using Ubuntu 14.1 and python 2.7

like image 635
vkmv Avatar asked Sep 28 '14 18:09

vkmv


2 Answers

To solve these issues, I followed the install bash script here: https://gist.github.com/amirsani/d2aa0763cc138902bf73

I still had the same error occur during testing at the ending of all the installation so I did this

sudo apt-get remove libopenblas-base

Which I got from here: Installing lapack for numpy

This appears to have solved my original problem (similar to yours but not identical) where I was attempting to run the following from ipython

from ortools.linear_solver import pywraplp

which produced an identical error to the one you had.

like image 191
dean keithly Avatar answered Nov 14 '22 15:11

dean keithly


The error message shows that your numpy installation is in '/usr/local/lib', but apt-get will put numpy in '/usr/lib'. This suggests to me that you have another copy of numpy which was installed by another method (e.g. pip install). Check if you have a directory called /usr/lib/python2.7/dist-packages/numpy/. If so, you just need to make sure that Python imports numpy from here and not from '/usr/local/lib'.

Try deleting, renaming or moving the directory /usr/local/lib/python2.7/dist-packages/numpy/, alternatively you can change sys.path from within Python.

like image 33
user7813790 Avatar answered Nov 14 '22 15:11

user7813790