Skip to content

Instantly share code, notes, and snippets.

@yatsu
Created April 5, 2020 10:31
Show Gist options
  • Save yatsu/47bdde35e8abbe7d14bbe730342aa9e0 to your computer and use it in GitHub Desktop.
Save yatsu/47bdde35e8abbe7d14bbe730342aa9e0 to your computer and use it in GitHub Desktop.
Install numpy with enabling openblas using pip on macOS
# Setup HomeBrew: https://brew.sh/
brew install openblas
pip download --no-binary :all: --no-deps numpy
unzip numpy-1.18.2.zip # (you may have newer version)
cd numpy-1.18.2
cat > site.cfg <<EOF
[openblas]
libraries = openblas
library_dirs = $(brew --prefix openblas)/lib
include_dirs = $(brew --prefix openblas)/include
runtime_library_dirs = $(brew --prefix openblas)/lib
EOF
pip install .
# Check the installed numpy config
# (Note that you must leave the numpy source directory to run this)
python3 -c "import numpy; numpy.show_config()"
# Test the performance with test_numpy.py (https://gist.github.com/alimuldal/eb0f4eea8af331b2a890)
OMP_NUM_THREADS=1 python test_numpy.py
OMP_NUM_THREADS=8 python test_numpy.py
@yatsu
Copy link
Author

yatsu commented Jan 2, 2021

Probably you have lost or broken libbz2 which had been used by Python.

Try this gist to reinstall Python.
https://gist.github.com/yatsu/9ae2dc633511d6d97efccd4fcfa8c8b1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment