'"RuntimeError: implement_array_function method already has a docstring", trying to import numpy. How do I solve this?

I am trying to run a script importing numpy, and it shows this error:

Traceback (most recent call last):
  File "C:/Users/<user>/pycharm/<my_project>/../examples/<my_file>.py", line 5, in <module>
    import numpy as np
  File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\overrides.py", line 47, in <module>
    """)
RuntimeError: implement_array_function method already has a docstring

Process finished with exit code 1

I googeled and my results are

  1. that it might have to do with importing numpy multiple times and
  2. that it might be related to some software called usgwi that python may run under.

I am using python 3.7 and numpy 1.18.5.

Thank you!



Solution 1:[1]

I think issue with numpy. See https://github.com/numpy/numpy/issues/14384

I had issue in VSCode using python AREPEL. I fixed with:

python3 -m pip install --user numpy -U

$ python3 -m pip freeze | grep numpy
numpy==1.19.4
$ python3 --version
Python 3.8.6

Solution 2:[2]

Downgrading numpy to numpy==1.15.4 will solve this issue.

pip install --no-cache-dir -I numpy==1.15.4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user14819803
Solution 2 Hrvoje