pythonnumpyvisual-studio-codeaccelerate

Having problems running numpy - error about ‘buggy accelerate backend’? (python, vs code, OS X)


Very new python learner here.

Trying to build my first project, but having so many issues with numpy. When I try to run the programme, it comes back with this error:

    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

I think I have everything installed correctly on VS Code, although figuring that out was a headache too.

On googling the error something about accelerate kept coming up, but I don't know how to delete or uninstall it... or even what it is.

Any tips would be so helpful!

If any more info is needed, let me know. This is my first question here.

Thank you! :)


Solution

  • Were you using python 3.9 when this happened?

    If you do not need python3.9, then I'd encourage that you specify a lower version of Python for your virtual environment by running the following command:
    python3.<insert lower version here> -m venv venv
    For example, if you want to use python3.8:
    python3.8 -m venv venv
    After you can install the necessary dependencies and things should work.

    If you need(!) python3.9:

    1. Go to venv/lib/python3.9/site-packages/numpy and open the root init.py file.
    2. Go to line 270 and comment out the lines 270 - 287. This is where the runtime error is being thrown for macOS darwin, and it seems to have something to do with the python environment.

    This should also work, although I would recommend the first solution.