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
Unittest: RuntimeError: implement_array_function method already has a docstring #14012
Comments
Is there any work around for this? This has made is impossible for us to run automated tests on our builds. |
This comment has been minimized.
This comment has been minimized.
Are you running tests with subinterpreters or somehow trying to re-initialize numpy in the same process after already importing it once (i.e. removing it from the |
Speaking for myself, I checked for re-initialization and that was not the problem. And yes, the numpy version increase was the only change in the system (no updates to the code at all) and tests that were previously passing on AppVeyor and Travis-CI started failing. Restricting the numpy version caused the tests to start passing again (as expected when the only change is the numpy version). |
There's 22 upvotes on this, so very likely to be a real issue. It would be super helpful if someone provide a full reproducer. The issue description isn't enough, that does basically nothing and the environment isn't well-specified. Something like:
|
@rgommers
My env:
|
@fjsj thanks. That passes for me. Is the |
@rgommers thanks for trying. Strange it passes. Here are the full output of all steps: full-steps-with-output.txt My env:
Tried bash as well, got the same error. |
Any update on this? |
Is there any workaround available for this issue? |
@mattip i'm trying to debug an issue where importing numpy throws this error and would like to understand what is causing it. would you be able to explain the simplest way to reproduce this error? e.g. simply doing
doesn't throw. neither does your suggestion remove numpy from
@aburrell how were you able to check for re-initialization? |
@jroitgrund, I seem to recall that this would happened when there was somehow an install of NumPy with stray old files around. Can you try uninstalling numpy (as often as necessary) and then reinstalling it? EDIT: to be clear, I may recall this completely incorrectly, but it would still be good to know/check how you installed numpy. |
@seberg This is happening in a production environment where a lot of different things could be causing it, not on my local machine. I'm trying to understand specifically what causes the issue and find the smallest possible reproduction, so that I can debug my production environment. |
fwiw, the |
Forgot to mention that doesn't repro it either for me.
EDIT: I guess more generally, if there's a known limitation of numpy and it's supposed to throw, does somebody know exactly what the limitation is? should numpy be defensive against that situation by asserting with a clear error message instead of the docstring error, which seems incidental? |
Has this not been solved? |
@blakete are you building your own numpy, or any chance you had an old setup.py installed numpy, that (e.g. try uninstalling multiple times)? I am not sure this should happen unless you have modified anything. If you use a dev setup (git), ensure you delete all local changes with |
@seberg I have resolved the issue. Pycharm has a bug and is causing the issue. Apologies for the false alarm. It works perfectly via terminal. Cheers! |
@blakete Could you link the bug in Pycharm? I'm having a similar problem when running unittest in pycharm in debug mode. |
is there a ticket to jetbrains? |
@schniewmatz I have not found the bug on any Pycharm channel but after updating it has resolved my issues. If that does not work, try invalidating / clearing Pycharm caches. |
which version 2020.1 ? |
My application uses the python package gensim, which requires numpy. I want to run some unit tests, but always get
RuntimeError: implement_array_function method already has a docstring
. It was tested on Windows 10 and Docker with python 3.7.4. The problem seems to exist since numpy 1.16.0. If I use numpy 1.15.4 it works without problems.Reproducing code example:
Error message:
Numpy/Python version information:
1.16.4 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)]
The text was updated successfully, but these errors were encountered: