pandas: BUG: Python 3.9 Polyfit sanity test emitted a warning

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

import pandas as pd

Problem description

When importing pandas using python 3.9.0 I get the following error:

python(81328,0x10d755dc0) malloc: can't allocate region
:*** mach_vm_map(size=18446744071827312640, flags: 100) failed (error code=3)
python(81328,0x10d755dc0) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
  File "/Users/paul/python/test/t.py", line 2, in <module>
    import pandas as pd
  File "/Users/paul/python/test/venv/lib/python3.9/site-packages/pandas/__init__.py", line 11, in <module>
    __import__(dependency)
  File "/Users/paul/python/test/venv/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

Expected Output

Pandas should import without an error.

Output of pd.show_versions()

I am unable to run pd.show_versions() because the program crashes as soon as pandas is imported. I am installing pandas 1.1.3 on a Mac.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

This one worked for me:

$ pip cache remove numpy
$ brew install openblas # make sure OpenBLAS is installed
$ OPENBLAS="$(brew --prefix openblas)" pip install numpy # let numpy's setup.py know where OpenBLAS is installed

None of those workarounds work for me even in a clean virtual environment (3.9) and an empty pip cache

pip install matplotlib

always fails with

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

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.

1.先安装 OpenBLAS $ brew install openblas 2. 然后指定 OpenBLAS 作为 BLAS 提供方, 安装 Numpy 和 pandas $ OPENBLAS=“$(brew --prefix openblas)” pip3 install numpy pandas

First run pip uninstall numpy 完美!

numpy 1.19.3 has 3.9 wheels up on pypi now

Now that numpy has the wheel I am able to install with no issues.

@matthiasdiener Just

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

does indeed work; but subsequent

pip install matplotlib

results in pages and pages or errors ending in

ERROR: Failed building wheel for matplotlib

followed by an attempt to build matplotlib, which ends in more pages of errors and

ERROR: Command errored out with exit status 1: /Users/Rax/Documents/Projects/Coding/Python/venvs/dataviz/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-install-e0fr6lw0/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-install-e0fr6lw0/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-record-p4qzyrcr/install-record.txt --single-version-externally-managed --compile --install-headers /Users/Rax/Documents/Projects/Coding/Python/venvs/dataviz/include/site/python3.9/matplotlib Check the logs for full command output.

What am I doing wrong?