8000 BUG: Error installing NumPy via Pip on macOS Big Sur with python from HomeBrew · Issue #17784 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Error installing NumPy via Pip on macOS Big Sur with python from HomeBrew #17784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MarioCatuogno opened this issue Nov 16, 2020 · 80 comments
Labels
32 - Installation Problems installing or compiling NumPy

Comments

@MarioCatuogno
Copy link
MarioCatuogno commented Nov 16, 2020

Reproducing code example:

Install Pandas with PIP after a clean install of macOS Big Sur and Python3.9 via Homebrew.

pip install pandas
pip3 install pandas
pip3 install pandas --no-build-isolation --no-cache-dir
sudo pip3 install pandas --no-cache-dir

These are the only packages actually installed:

Package    Version
---------- -------
pip        20.2.4
setuptools 50.3.2
wheel      0.35.1

Error message:

  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python@3.9/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/tmpzr3sthd6
       cwd: /private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-install-pvlaq6iq/pandas
  Complete output (23 lines):
  init_dgelsd failed init
  Traceback (most recent call last):
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-build-env-ly4c8n5_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 149, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-build-env-ly4c8n5_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-build-env-ly4c8n5_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-build-env-ly4c8n5_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 488, in <module>
      import numpy as np
    File "/private/var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/pip-build-env-ly4c8n5_/overlay/lib/python3.9/site-packages/numpy/__init__.py", line 286, in <module>
      raise RuntimeError(msg)
  RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
  RankWarning: Polyfit may be poorly conditioned

  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/zv/0q58rjv549bd4qjdqlrwlvl40000gn/T/tmpzr3sthd6 Check the logs for full command output.

NumPy/Python version information:

I have also installed NumPy first (numpy 1.19.4) still getting the same error.
I have opened the following issues and in both of them they said that it's a Numpy error: Pandas#37880 and Pip#9138

@mattip
Copy link
Member
mattip commented Nov 16, 2020

The binary wheel for python 3.9 on macOSx is available at https://pypi.org/project/numpy/#files for 1.19.4, as numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whl. Maybe somehow pip is rejecting it and compiling from source instead. In order to prevent that, could you do python3.9 -m pip install --only-binary=:all: numpy==1.19.4 8000 in a clean virtualenv and report the results?

@a-glapinski
Copy link
a-glapinski commented Nov 16, 2020

I have the same problem as @MarioCatuogno. I've tried running python3.9 -m pip install --only-binary=:all: numpy==1.19.4 command both in virtualenv and outside of it, but I got following error:

ERROR: Could not find a version that satisfies the requirement numpy==1.19.4 (from versions: none)
ERROR: No matching distribution found for numpy==1.19.4

I changed --only-binary parameter value to :all from :all: and it installed numpy correctly:

Processing ./Library/Caches/pip/wheels/6f/d7/25/0fe5a4a476d4881c00f6e6914d4d40f9c42cfe334faafd79a3/numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.19.4

but I still got following (probably the same as @MarioCatuogno) error when installing pandas:

 Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/adrian.glapinski/INF/sem7/pythonProject/venv/bin/python /Users/adrian.glapinski/INF/sem7/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/tmpbnj2j7mz
       cwd: /private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-install-6t_j_b4h/pandas
  Complete output (23 lines):
  init_dgelsd failed init
  Traceback (most recent call last):
    File "/Users/adrian.glapinski/INF/sem7/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/Users/adrian.glapinski/INF/sem7/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/adrian.glapinski/INF/sem7/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-build-env-qxaf5373/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 149, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "/private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-build-env-qxaf5373/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "/private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-build-env-qxaf5373/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-build-env-qxaf5373/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 488, in <module>
      import numpy as np
    File "/private/var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/pip-build-env-qxaf5373/overlay/lib/python3.9/site-packages/numpy/__init__.py", line 286, in <module>
      raise RuntimeError(msg)
  RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
  RankWarning: Polyfit may be poorly conditioned
  
  ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/adrian.glapinski/INF/sem7/pythonProject/venv/bin/python /Users/adrian.glapinski/INF/sem7/pythonProject/venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/4z/1tq_0rlj1z1dngsf8yjzr9s8lw7_x8/T/tmpbnj2j7mz Check the logs for full command output.

EDIT:
What is odd to me is that python3.9 -m pip install --only-binary=:all numpy==1.19.4 command is processing numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl instead of numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whl which I can see at https://pypi.org/project/numpy/1.19.4/#files, but I have zero knowledge about pip so I don't know if it matters at all.

@eric-wieser eric-wieser added the 32 - Installation Problems installing or compiling NumPy label Nov 16, 2020
@MarioCatuogno
Copy link
Author

@mattip I've tried with the python3.9 -m pip install --only-binary=:all numpy==1.19.4 and I'm still getting the same error installing Pandas with PIP.
Anyway I didn't have problem installing Numpy with PIP (using pip install numpy I can install the late 8000 st version of Numpy), the Numpy error I get is with other packages installed with PIP (eg. Pandas)

@mattip
Copy link
Member
mattip commented Nov 16, 2020

The option --only-binary=:all is invalid and is being ignored, you must use --only-binary=:all: where :all is wrong and :all: is correct. It seems your version of python has decided to reject the macosx_10_9_x86_64 tag, since the wheel it builds from source has the macosx_11_0_x86_64 platform tag.

I have the same problem as @MarioCatuogno. I've tried running python3.9 -m pip install --only-binary=:all: numpy==1.19.4 command both in virtualenv and outside of it, but I got following error: ERROR: Could not find a version that satisfies the requirement numpy==1.19.4 (from versions: none)

So somehow pip is not recognizing the binary wheels and is rebuilding the wheel from source, detecting the buggy local Accelerate library and binding it to NumPy.

Now we need someone to find out why the python you are using decided that the macosx_10_9_x86_64 tag is not acceptable anymore. The installer available via python.org still lists "for OS X 10.9 and later" on the macOSx line. Where did you install python from?

@MarioCatuogno
Copy link
Author

@mattip I installed Python3.9 via Homebrew using "brew install python3" in Terminal. I did a clean installation of macOS Big Sur and the first thing I did was the setup of Homebrew and Python, no other apps or binaries installed.

@a-glapinski
Copy link
a-glapinski commented Nov 16, 2020

@mattip I installed it through brew install python command. I installed it after update to Big Sur.

@mattip
Copy link
Member
mattip commented Nov 16, 2020

Could you try with the python available in the link above instead of the homebrew one? Perhaps homebrew is rejecting our binary wheel.

@a-glapinski
Copy link

@mattip After installing Python from the link above, pandas (and numpy) installed correctly and everything seems to work fine.

@mattip
Copy link
Member
mattip commented Nov 16, 2020

Over at homebrew they recommend users who install python via homebrew continue with that workflow and use brew install numpy as well.

@mattip
Copy link
Member
mattip commented Nov 16, 2020

There is also pypa/packaging#319. Packaging is vendored into pip, so if that PR goes in, and a new version of pip is released, and people start using it, this issue might get solved.

@mattip mattip changed the title BUG: Error Numpy installing Pandas via Pip on macOS Big Sur BUG: Error installing NumPy via Pip on macOS Big Sur with python from HomeBrew Nov 16, 2020
@MarioCatuogno
Copy link
Author

@mattip So, as of today, the only way to install Pandas with pip is to uninstall Python3 installed via Homebrew and use the one from the Python website?

@mattip
Copy link
Member
mattip commented Nov 16, 2020

I need to answer your question with a question, sorry: if you install numpy with brew install python3.9; brew install numpy can you then install pandas to that python? I do not have a macOS system to test on.

@MarioCatuogno
Copy link
Author

@mattip Already tried with brew install numpy and then pip3 install pandas, still getting the same error.

@mattip
Copy link
Member
mattip commented Nov 17, 2020

Here is another suggestion, based on the idea that the only problem is that the wheel has the wrong name. Can you download the appropriate wheel for your python version from https://pypi.org/project/numpy/#files, so numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whl for python 3.9, rename it to numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl, and try to install the renamed wheel with pip install numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl ?

@kadaliao
Copy link
kadaliao commented Nov 17, 2020

Here is another suggestion, based on the idea that the only problem is that the wheel has the wrong name. Can you download the appropriate wheel for your python version from https://pypi.org/project/numpy/#files, so numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whl for python 3.9, rename it to numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl, and try to install the renamed wheel with pip install numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl ?

ERROR: numpy-1.19.4-cp36-cp36m-macosx_10_9_x86_64.whl is not a supported wheel on this platform.

ERROR: numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl is not a supported wheel on this platform.

@mattip
Copy link
Member
mattip commented Nov 17, 2020

@kadaliao what does this print out for you?

python -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5

@kadaliao
Copy link

@kadaliao what does this print out for you?

python -c"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" |head -5
cp38-cp38-macosx_11_0_x86_64
cp38-cp38-macosx_11_0_intel
cp38-cp38-macosx_11_0_fat64
cp38-cp38-macosx_11_0_fat32
cp38-cp38-macosx_11_0_universal

@mattip
Copy link
Member
mattip commented Nov 17, 2020

So download numpy-1.19.4-cp38-cp38-macosx_10_9_x86_64.whl and rename it to numpy-1.19.4-cp38-cp38-macosx_11_0_x86_64.whl

@aniaan
Copy link
aniaan commented Nov 18, 2020

So download numpy-1.19.4-cp38-cp38-macosx_10_9_x86_64.whl and rename it to numpy-1.19.4-cp38-cp38-macosx_11_0_x86_64.whl

I did what you did and the line import numpy as np did not report an error, and I am local to python 3.8, big sur.

Name numpy-1.19.4-cp38-cp38-macosx_10_9_x86_64.whl to numpy-1.19.4-cp38-cp38-macosx_11_0_x86_64.whl and then pip install numpy-1.19.4-cp38-.cp38-macosx_11_0_x86_64.whl

@Sshankar7
Copy link

So download numpy-1.19.4-cp38-cp38-macosx_10_9_x86_64.whl and rename it to numpy-1.19.4-cp38-cp38-macosx_11_0_x86_64.whl

cp38-cp38 results in an unsupported wheel but I tried downloading numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whland renaming it to numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl. This is installed correctly. But installing pandas after that still results in an error.

@Sshankar7
Copy link
Sshankar7 commented Nov 18, 2020

So download numpy-1.19.4-cp38-cp38-macosx_10_9_x86_64.whl and rename it to numpy-1.19.4-cp38-cp38-macosx_11_0_x86_64.whl

cp38-cp38 results in an unsupported wheel but I tried downloading numpy-1.19.4-cp39-cp39-macosx_10_9_x86_64.whland renaming it to numpy-1.19.4-cp39-cp39-macosx_11_0_x86_64.whl. This is installed correctly. But installing pandas after that still results in an error.

After installing numpy, I downloaded pandas-1.1.4.tar.gz from https://github.com/pandas-dev/pandas/releases and did the installation from source and pandas installed correctly and working fine.

To install from source:
Unzip the downloaded file and navigate to the root folder.

  • pip3 install cython
  • pip3 setup.py install

@vpoirot
Copy link
vpoirot commented Nov 18, 2020

A workaround which seems to work (at least on my MacBook Pro 2018). If you are using homebrew, replace Mac OS BLAS by openblas for pip install.

brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip install numpy pandas

@charris
Copy link
Member
charris commented Apr 30, 2021

pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy

@TheMissingPort
Copy link

pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy

WARNING: Value for scheme.headers does not match. Please report this to pypa/pip#9617
distutils: /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/UNKNOWN
sysconfig: /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Looking in index

@pradyunsg
Copy link

That's a warning, and the link it outputs should contain a clear answer to any questions you may have.

@charris
Copy link
Member
charris commented May 1, 2021

@TheMissingPort That warning is unique to the newly released pip and is intended to warn of upcoming changes that might affect some distributions. It can be ignored.

@liviaerxin
Copy link

@Julian Are you using old pip version below 21.x.x? That version of pip will reject binary wheel numpy-1.20.3-cp37-cp37m-macosx_10_9_x86_64.whl and use numpy-1.20.3.zip to build from source, if you are using intel-emulated python in Apple Silicon.

New python3.9 has adopt pip-21.1.1 when creating a virtual enviroment(so no need to upgrade pip in your venv) and pip install numpy should install from wheel directly.

❯ ll /opt/homebrew/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ensurepip/_bundled
total 4560
-rw-r--r--  1 xxxxx  admin        0 May  3 23:11 __init__.py
drwxr-xr-x  3 xxxxx  admin       96 Jun 10 20:57 __pycache__
-rw-r--r--  1 xxxxx  admin  1547644 May  3 23:11 pip-21.1.1-py3-none-any.whl
-rw-r--r--  1 xxxxx  admin   784941 May  3 23:11 setuptools-56.0.0-py3-none-any.whl

@nfx
Copy link
nfx commented Jun 12, 2021

This issue persists with pipenv (version 2021.5.29) and pip (21.1.2). and this issue does not depend on Apple silicon - x86_64 is affected by this.

@mattip
Copy link
Member
mattip commented Jun 13, 2021

@nfx which part of this issue? I have lost track of where we are here.

@Julian
Copy link
Julian commented Jun 13, 2021

(same here, to me this should be closed at this point)

@whao
Copy link
whao commented Jun 15, 2021

Issue persists when using pipenv with homebrew python 3.9 on x86 macOS.

➜  Python pipenv --python 3
Creating a virtualenv for this project...
Pipfile: /Users/whao/Developer/Python/Pipfile
Using /usr/local/bin/python3.9 (3.9.5) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.9.5.final.0-64 in 355ms
  creator CPython3Posix(dest=/Users/whao/.local/share/virtualenvs/Python-G7ezAV7m, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/whao/Library/Application Support/virtualenv)
    added seed packages: pip==21.1.2, setuptools==57.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

✔ Successfully created virtual environment! 
Virtualenv location: /Users/whao/.local/share/virtualenvs/Python-G7ezAV7m
(Python) ➜  Python pip3 list           
Package    Version
---------- -------
pip        21.1.2
setuptools 57.0.0
wheel      0.36.2
(Python) ➜  Python pipenv install pandas                                                                                                                   
Installing pandas...
Adding pandas to Pipfile's [packages]...
✔ Installation Succeeded 
Pipfile.lock (be159f) out of date, updating to (c2bdec)...
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed! 
ERROR:pip.subprocessor:Command errored out with exit status 1:
  Traceback (most recent call last):
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 181, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 211, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 197, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 248, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 513, in <module>
      setup_package()
    File "setup.py", line 505, in setup_package
      setup(**metadata)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-install-hxaxjnon/numpy/numpy/distutils/core.py", line 169, in setup
      return old_setup(**new_attr)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 328, in run
      impl_tag, abi_tag, plat_tag = self.get_tag()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 252, in get_tag
      plat_name = get_platform(self.bdist_dir)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 48, in get_platform
      result = calculate_macosx_platform_tag(archive_root, result)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/macosx_libfile.py", line 356, in calculate_macosx_platform_tag
      assert len(base_version) == 2
  AssertionError
  ----------------------------------------
  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
----------------------------------------
Traceback (most recent call last):
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 764, in <module>
    main()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 758, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 741, in _main
    resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 702, in resolve_packages
    results, resolver = resolve(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 684, in resolve
    return resolve_deps(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 1397, in resolve_deps
    results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 1110, in actually_resolve_deps
    resolver.resolve()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 825, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 180, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 268, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 383, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 229, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 350, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 306, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 339, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 287, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/distributions/sdist.py", line 38, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/distributions/sdist.py", line 66, in _setup_isolation
    self.req.build_env.install_requirements(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/build_env.py", line 202, in install_requirements
    call_subprocess(args, spinner=spinner)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pipenv.patched.notpip._internal.exceptions.InstallationError: Command errored out with exit status 1: /Users/whao/.local/share/virtualenvs/Python-G7ezAV7m/bin/python /Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip install --ignore-installed --no-user --prefix /private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-zk03c0xi/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.

@liviaerxin
Copy link

Issue persists when using pipenv with homebrew python 3.9 on x86 macOS.

➜  Python pipenv --python 3
Creating a virtualenv for this project...
Pipfile: /Users/whao/Developer/Python/Pipfile
Using /usr/local/bin/python3.9 (3.9.5) to create virtualenv...
⠦ Creating virtual environment...created virtual environment CPython3.9.5.final.0-64 in 355ms
  creator CPytho
F438
n3Posix(dest=/Users/whao/.local/share/virtualenvs/Python-G7ezAV7m, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/whao/Library/Application Support/virtualenv)
    added seed packages: pip==21.1.2, setuptools==57.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

✔ Successfully created virtual environment! 
Virtualenv location: /Users/whao/.local/share/virtualenvs/Python-G7ezAV7m
(Python) ➜  Python pip3 list           
Package    Version
---------- -------
pip        21.1.2
setuptools 57.0.0
wheel      0.36.2
(Python) ➜  Python pipenv install pandas                                                                                                                   
Installing pandas...
Adding pandas to Pipfile's [packages]...
✔ Installation Succeeded 
Pipfile.lock (be159f) out of date, updating to (c2bdec)...
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed! 
ERROR:pip.subprocessor:Command errored out with exit status 1:
  Traceback (most recent call last):
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_vendor/pep517/_in_process.py", line 181, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 211, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 197, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 248, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 513, in <module>
      setup_package()
    File "setup.py", line 505, in setup_package
      setup(**metadata)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-install-hxaxjnon/numpy/numpy/distutils/core.py", line 169, in setup
      return old_setup(**new_attr)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
      return distutils.core.setup(**attrs)
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 328, in run
      impl_tag, abi_tag, plat_tag = self.get_tag()
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 252, in get_tag
      plat_name = get_platform(self.bdist_dir)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 48, in get_platform
      result = calculate_macosx_platform_tag(archive_root, result)
    File "/private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-giu4uxqe/overlay/lib/python3.9/site-packages/wheel/macosx_libfile.py", line 356, in calculate_macosx_platform_tag
      assert len(base_version) == 2
  AssertionError
  ----------------------------------------
  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
----------------------------------------
Traceback (most recent call last):
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 764, in <module>
    main()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 758, in main
    _main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 741, in _main
    resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 702, in resolve_packages
    results, resolver = resolve(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/resolver.py", line 684, in resolve
    return resolve_deps(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 1397, in resolve_deps
    results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 1110, in actually_resolve_deps
    resolver.resolve()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/utils.py", line 825, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 180, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 268, in _resolve_one_round
    their_constraints.extend(self._iter_dependencies(best_match))
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/resolver.py", line 383, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 229, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 350, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 306, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 339, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/legacy_resolve.py", line 287, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 508, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/distributions/sdist.py", line 38, in prepare_distribution_metadata
    self._setup_isolation(finder)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/distributions/sdist.py", line 66, in _setup_isolation
    self.req.build_env.install_requirements(
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/build_env.py", line 202, in install_requirements
    call_subprocess(args, spinner=spinner)
  File "/Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pipenv.patched.notpip._internal.exceptions.InstallationError: Command errored out with exit status 1: /Users/whao/.local/share/virtualenvs/Python-G7ezAV7m/bin/python /Users/whao/Library/Python/3.9/lib/python/site-packages/pipenv/patched/notpip install --ignore-installed --no-user --prefix /private/var/folders/1x/57z8wg6935vbycw_s745vnt80000gn/T/pip-build-env-zk03c0xi/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.

I have tested Python3.9 install Numpy using -m venv in x86_64 in Apple Silicon successfully. Make sure you are using x86_64 python3.9 not the native. In you post, your pip is trying to download source file *numpy.zip and compile that rather than install binary wheel numpy-1.20.3-cp39-cp39-macosx_10_9_x86_64.whl.

❯ file `which python3.9`
/usr/local/opt/python@3.9/bin/python3.9: Mach-O 64-bit executable x86_64
❯ python3.9 -m venv venv39
❯ source venv39/bin/activate
❯ pip install numpy
Collecting numpy
  Downloading numpy-1.20.3-cp39-cp39-macosx_10_9_x86_64.whl (16.1 MB)
     |████████████████████████████████| 16.1 MB 370 kB/s 
Installing collected packages: numpy
Successfully installed numpy-1.20.3
WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the '/Users/siyaochen/venv39/bin/python3.9 -m pip install --upgrade pip' command.
❯ arch
i386

@nfx
Copy link
nfx commented Jun 16, 2021

@nfx which part of this issue? I have lost track of where we are here.

installing NumPy via pip (21.1.2) in pipenv (version 2021.5.29) on macOS Big Sur with python 3.9.5 from HomeBrew on x86_64 hardware

@mattip
Copy link
Member
mattip commented Jun 17, 2021

It seems you should be downloading the numpy-1.20.3-cp39-cp39-macosx_10_9_x86_64.whl wheel. Does using --only-binary :all: help?

@robmoore
Copy link

What helped me get past this was setting SYSTEM_VERSION_COMPAT=1 in my environment prior to running pip.

See this post for context.

@gtrabanco
Copy link
gtrabanco commented Jul 15, 2021

In my case I had the same error and because it was a file permission problem I used:

sudo chown -R ${USER}:staff "$(brew --prefix)/lib/python3.9/site-packages/numpy"

@PedroRegisPOAR PedroRegisPOAR mentioned this issue Oct 10, 2021
< 10000 svg width="12" height="12" data-target="tracked-issues-progress.progress" data-circumference="31" > 7 tasks
@whao
Copy link
whao commented Oct 26, 2021

What helped me get past this was setting SYSTEM_VERSION_COMPAT=1 in my environment prior to running pip.

See this post for context.

I think this should be the real reason. 👍👍👍

@rgommers
Copy link
Member

There are multiple issues mixed in here, and after the numpy 1.21.4 release they should all be fixed. This issue has:

  • Can't install on x86_64 -> most recent pip should be able to find and install wheels
  • Can't install on arm64 -> numpy 1.21.4 has working arm64 and universal2 wheels.
  • Can't install pipenv install pandas -> with numpy having wheels and oldest-supported-numpy being updated since a week ago to point to 1.21.4, this should be fixed.

I will close the issue. If you still have problem, please open a new issue, describing which of these problems (or yet another problem) you are seeing and providing a full build/install log.

cypressf added a commit to mit-jp/climate-risk-data-cleaning that referenced this issue Dec 2, 2021
This helps other developers run the code more easily.

To install dependencies, and run a file called `main.py` for example:

```
python3 -m pip install --user pipenv
pipenv install
pipenv run python main.py
```

See

- https://packaging.python.org/tutorials/managing-dependencies/
- https://docs.python-guide.org/dev/virtualenvs/

Note: on macOS Big Sur there is a bug where pipenv install will take
a long time, then fail when installing numpy. [A workaround](numpy/numpy#17784 (comment)) is to set
the environment variable `SYSTEM_VERSION_COMPAT=1`.
@shibaa987
Copy link

A workaround which seems to work (at least on my MacBook Pro 2018). If you are using homebrew, replace Mac OS BLAS by openblas for pip install.

brew install openblas OPENBLAS="$(brew --prefix openblas)" pip install numpy pandas

This worked on Mac M1 Pro as well. Thank you so much.

@sjlearmonth
Copy link

I am getting this error when trying to install a numpy wheel package on to my apple m4 silicon machine in termimal...

pip install /Users/StephenLearmonth/Downloads/numpy-1.26.0-cp311-cp311-macosx_11_0_arm64.whl

ERROR: numpy-1.26.0-cp311-cp311-macosx_11_0_arm64.whl is not a supported wheel on this platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32 - Installation Problems installing or compiling NumPy
Projects
None yet
Development

No branches or pull requests

0