macOS Python Runtime Error

Good Afternoon Everyone,

I am attempting to learn Python alongside a MOOC and am having trouble importing packages using Atom & PyCharm.

After installing the packages, I am met with the following errors:

init_dgelsd failed init
Traceback (most recent call last):
File “/Users/ryanborunda/Documents/Coursera - Understanding & Visualizing Data/Week 1/test.py”, line 1, in
import numpy as np
File “/Users/ryanborunda/.pyenv/versions/3.9.0/lib/python3.9/site-packages/numpy/init.py”, line 286, in
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

These errors happen when attempting to import numpy and pandas as such:

import numpy as np
import pandas as pd

Other forums mention I may need to force macOS to not use Accelerate and force “binary installs”? Can anyone help me remedy this or lead me in the right direction?

the same problem, how to fix it?

looks like I have fixed this, by
1, install a new environment by pvenv. (previously I am using virtualenv)
2, install python 3.7.1 (previously I am using 3.9)

Same problem on two different MacBooks. To @franson this seems to be directly related to Python 3.9. I have 3.8 and earlier virtualenvs that work fine. I’m trying to get my 3.9 env going.

It’s probably the case that third-party packages (like numpy, which is where the polyfit error is coming from) aren’t compatible with Python 3.9 yet. This blog post can give some more context on it, but the short version is that it takes time for the rest of the Python ecosystem to catch up to new releases. Seems like both of you found the ‘right’ fix of using a different version of Python.

Thank you all for your suggestions. Reverting back to an earlier Python version helped.