Different ways to install numpy, scipy, and matplotlib on macOS via homebrew Different ways to install numpy, scipy, and matplotlib on macOS via homebrew numpy numpy

Different ways to install numpy, scipy, and matplotlib on macOS via homebrew


Your analysis seems correct: variants 1 and 3 will install numpy/scipy from the python package index (PyPI) and will use pre-built wheels (if available for your platform, which they most likely are).Variant 2 installs the brew formula.

As mentioned by @Evhz, the conda packages for numpy and scipy use the Intel Math Kernel library, which can provide significant speedups (not just on Intel processors) versus the packages installed from PyPI or brew, both of which are linked against OpenBLAS.

Concerning which method to prefer: it's not entirely straightforward.

  • Yes, on the surface, using brew to manage both the python interpreter and the python packages would seem consistent.
  • However, homebrew only provides formulae for a handful of python packages, so you'll end up needing to mix with pip in any case.
  • If you want performance, you go with conda, which will be managing both the interpreter and python packages.
  • However, also anaconda / conda-forge still have some catching up to do with PyPI, so you'll likely need to mix with pip again.

In the end, there is no perfect solution but as long as you knowingly decide for one, you're unlikely to run into issues.