Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Last active January 27, 2022 01:23
Show Gist options
  • Save MohamedElashri/25c3999df42da201b8819d8bb811a5e4 to your computer and use it in GitHub Desktop.
Save MohamedElashri/25c3999df42da201b8819d8bb811a5e4 to your computer and use it in GitHub Desktop.
[Mac Big sur on M1 python package pip] Fix Mac Big sur on M1 python package pip cannot build wheels #python

To fix these problem until the official pip support these changes and it becomes standard for python installation and Homebrew

run the following steps in terminal

  1. brew install python@3.9 or brew re-install python@3.9

  2. brew install openblas `

  3. OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install cython --no-use-pep517

  4. OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install numpy --no-use-pep517

  5. OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install pandas --no-use-pep517

  6. OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install pybind11 --no-use-pep517

  7. OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install scipy --no-use-pep517

  8. brew install libjpeg zlib

  9. python3 -m pip install pillow

  10. python3 -m pip install matplotlib

can do the same for other packages but I was interested in data science and machine learning stuff like

OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install scikit-learn --no-use-pep517

OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install statsmodels --no-use-pep517

hint: you might need to run these with sudo depending on your enviroment desired for installation. Also pip should be upgraded to at least pip==20.3.0

@NesquikMike
Copy link

NesquikMike commented Jul 24, 2021

How did you know to do this? Any idea on how to fix this using poetry?

@MohamedElashri
Copy link
Author

How did you know to do this? Any idea on how to fix this using poetry?

There is a solution to use poetry to install packages
one example is to follow this repository

@saneel17
Copy link

I am able to install every package. But I am not able to install util. I used the following command.

OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=11.1 python3 -m pip install util --no-use-pep517

And I get this error: ERROR: Could not find a version that satisfies the requirement util (from versions: none)

Do you have any idea how to get util installed in a m1 mac

@MohamedElashri
Copy link
Author

MohamedElashri commented Jan 27, 2022

Hi, there is no package on pypi called util do you mean python-utils?

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