7

I'm on an Ubuntu 14.04.

I would have expected doing:

sudo apt-get install python-numpy

would've worked but it isn't the case...

The way I tried to check is by doing locate blas and found nothing that seemed relevant.

I would like a solution that doesn't involve me compiling from source.

The ideal solution is something that uses the ubuntu repos.

sebix
  • 2,943
  • 2
  • 28
  • 43
evan54
  • 3,585
  • 5
  • 34
  • 61

4 Answers4

4

In Ubuntu 14.04 and later, blas and lapack are installed as part of python-scipy and python3-scipy, so you need to install python-scipy. In Ubuntu 18.04 and earlier open the terminal and type:

sudo apt install python-scipy  

This command will also install libblas3 (Basic Linear Algebra Subprograms reference implementations, shared library) and liblapack3 (Library of linear algebra routines 3 - shared version) as dependencies, and it will also install python-numpy as a dependency if you don't already have it installed.

karel
  • 5,489
  • 46
  • 45
  • 50
  • For best results with this answer, first uninstall python-numpy package if you installed it using `pip` with the command `sudo pip uninstall python-numpy` . – karel Nov 15 '14 at 16:35
  • See also: [Find out if/which BLAS library is used by Numpy](https://stackoverflow.com/a/37190672/562769) – Martin Thoma Apr 10 '19 at 12:55
2

numpy.show_config() revealed that I had no BLAS support even though python3-scipy was already installed. Uninstalling and re-installing python3-scipy and python3-numpy fixed it:

sudo apt-get remove python3-scipy python3-numpy
sudo apt-get install python3-scipy python3-numpy

Now I have LAPACK/BLAS support:

>>> numpy.show_config()
openblas_lapack_info:
  NOT AVAILABLE
mkl_info:
  NOT AVAILABLE
atlas_3_10_blas_threads_info:
  NOT AVAILABLE
lapack_info:
    libraries = ['lapack', 'lapack']
    language = f77
    library_dirs = ['/usr/lib']
atlas_3_10_blas_info:
  NOT AVAILABLE
openblas_info:
  NOT AVAILABLE
blas_opt_info:
    libraries = ['blas', 'blas']
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    library_dirs = ['/usr/lib']
    language = c
blas_info:
    libraries = ['blas', 'blas']
    language = c
    library_dirs = ['/usr/lib']
    define_macros = [('HAVE_CBLAS', None)]
blas_mkl_info:
  NOT AVAILABLE
atlas_info:
  NOT AVAILABLE
atlas_3_10_threads_info:
  NOT AVAILABLE
lapack_mkl_info:
  NOT AVAILABLE
atlas_blas_threads_info:
  NOT AVAILABLE
atlas_3_10_info:
  NOT AVAILABLE
atlas_threads_info:
  NOT AVAILABLE
atlas_blas_info:
  NOT AVAILABLE
lapack_opt_info:
    libraries = ['lapack', 'lapack', 'blas', 'blas']
    define_macros = [('NO_ATLAS_INFO', 1), ('HAVE_CBLAS', None)]
    library_dirs = ['/usr/lib']
    language = c
Falko
  • 17,076
  • 13
  • 60
  • 105
James Hirschorn
  • 7,032
  • 5
  • 45
  • 53
1

Have your tried to use pip?

sudo pip install numpy

If you dont have pip install pip with instructions here

smushi
  • 701
  • 6
  • 17
  • haven't tried pip... generally I'm a bit biased against using pip because to do it properly it seems I have to do virtual environment stuff which doesn't sound that easy. If there is no repository solution pip is probably the next best thing. Unless I'm missing something... – evan54 Nov 15 '14 at 03:26
  • I find that `pip` works when having issues. Good at solving at issues – smushi Nov 15 '14 at 03:27
  • should I first uninstall numpy I installed through `sudo apt-get`? – evan54 Nov 15 '14 at 03:30
  • it didn't work, gave me a bunch of errors, couldn't find fortran compilers and a whole bunch of other stuff... – evan54 Nov 15 '14 at 03:46
  • also, seems to not have tried to download LAPACK /BLAS libaries but expected me to have done it already.. – evan54 Nov 15 '14 at 03:46
  • Try this: Go to: System -> Synaptic -> Administration -> Package Manager -> search on lapack (and/or blas), and mark for installation: libblas3gf libblas-doc libblas-dev liblapack3gf liblapack-doc liblapack-dev -> Apply – smushi Nov 15 '14 at 03:50
  • that is for an older version of ubuntu. I think synaptic is no more in 14.04. I'll install that using `apt-get` – evan54 Nov 15 '14 at 03:52
1

I have very good experience with the anaconda package manager (learning took me 1-2h). In my opinion it is easier to use than venv and more felixble than pip/env alone. After download and setup you have most of the package like numpy ready to go. So no problems like this anymore!

PlagTag
  • 6,107
  • 6
  • 36
  • 48