A.E
A.E

Reputation: 75

Can't install pandas and other python libraries on Mac M1

Fist I had lots of problems installing numpy library on a new Mac book M1. (mostly with pep517) and finally I installed it using python3 -m pip install --no-binary :all: --no-use-pep517 numpy==1.20rc1 command and now, when I try to install pandas (with pip3) library, I face a long list of errors:

Installing build dependencies ... error
ERROR: Command errored out with exit status 1: 
   command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix  .....)
      File "/private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-pxjl8ilr/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
        assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
    AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_11_0_universal2')
  
    ########### EXT COMPILER OPTIMIZATION ###########
    Platform      :
      Architecture: unsupported
      Compiler    : gcc
  
    CPU baseline  :
      Requested   : optimization disabled
      Enabled     : none
      Flags       : none
      Extra checks: none
      Requested   : optimization disabled
  
    CPU dispatch  :
      Enabled     : none
      Generated   : none
    CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_ext.py
  
    ########### CLIB COMPILER OPTIMIZATION ###########
    Platform      :
      Architecture: unsupported
      Compiler    : gcc
  
    CPU baseline  :
      Requested   : optimization disabled
      Enabled     : none
      Flags       : none
      Extra checks: none
      Requested   : optimization disabled
  
    CPU dispatch  :
      Enabled     : none
      Generated   : none
    CCompilerOpt._cache_write[796] : write cache to path -> /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-install-85rdftyx/numpy_6356c8e2cabc49c4a1a96e499bcbb920/build/temp.macosx-10.9-universal2-3.9/ccompiler_opt_cache_clib.py
    ----------------------------------------
    ERROR: Failed building wheel for numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/78/e4/a935f1701fac697c6c5458f86968bec5d2b4cb66e7f738225216ebaa20b4/pandas-1.2.2.tar.gz#sha256=14ed84b463e9b84c8ff9308a79b04bf591ae3122a376ee0f62c68a1bd917a773 (from https://pypi.org/simple/pandas/) (requires-python:>=3.7.1). Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/5_/ct_h64s936q91wl1qyv28l040000gn/T/pip-build-env-77vprpke/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
  Using cached pandas-1.2.1.tar.gz (5.5 MB)
  Installing build dependencies ... -^canceled
ERROR: Operation cancelled by user

How can I install pandas?? other libraries like scipy also face similar errors (some errors about clang.

Upvotes: 2

Views: 6406

Answers (3)

Calleb213
Calleb213

Reputation: 151

I solved this by following the steps on this link: https://laict.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9

Allowed me to install pyenv via homebrew and pyenv install python 3.8.6. once that was installed I was able to pip install everything I needed (including numpy and pandas which I have seen many other people have issues with). However, I previously tried to do all of this with 3.7.10 but ran into some issues similar to yours.

Im still unsure how to install python3.7 on mac M1 unfortunately.

Upvotes: -1

user2264438
user2264438

Reputation: 11

I used homebrew to install python and numpy, but got the same error message when trying to install pandas using pip.

I could get pandas to work installing it from source (https://github.com/pandas-dev/pandas/releases)

Unzip the downloaded file and navigate to the root folder.

  • pip3 install cython
  • python3 setup.py install

Upvotes: 1

A.E
A.E

Reputation: 75

i solved the problem using arch x86_64 pip3 install <package> Apparently arm64's M1 doesn't support some python libraries yet!

Upvotes: 2

Related Questions