I had tried installing a new package, but something seems to have been messed up.
When I try running this line of code:
import scipy.stats as stats
it returns the error:
TypeError: implement_array_function expected 6 arguments, got 5
I'm not sure why it's not working properly. I tried updating the package, but that didn't seem to work. Any suggestions would be greatly appreciated.
Edit
As pointed out in the comments by Tim Roberts
, it appears that NumPy
wasn't updated to the latest version, which caused the problem. Updating it seems to have fixed the issue.
numpy is an important dependency of
scipy.
Packages list ranges of "compatible" versions for their dependencies,
but it's not always feasible to test all combinations
so incompatible combos might slip past pip
.
Update to modern versions of both libraries. For example:
In general, when you upgrade an existing or install a new library, take the opportunity to upgrade the rest of your project. Then run your test suite to verify everyone is still playing nicely together. Roll back the versions if not.
You do have a test suite, right?
If not, go write a small one which minimally verifies
that all your import
s succeed.
It will be the canary in a coal mine during future version upgrades.