Open Anasdec opened 5 months ago
I also have an issue with numpy as a result import issue.
ImportError: cannot import name '_broadcast_shape' from 'numpy.lib.stride_tricks'
is there any way to fix it? thanks!
@psychedde1ic have you managed to get the issue solved?
In case any other poor souls come across this issue, I did some digging and the issue stems from changes in Numpy 1.26.
It seems this commit removed _broadcast_shape
and moved it under np.lib._stride_tricks_impl._broadcast_shape
. All main Numpy versions newer than 1.25.2
have this change.
So the solution for users would be to use Numpy version 1.25.2 or older. The developers of VectorBT would need to add this new import (if they really want to rely on undocumented parts not in Numpy's public API) if they want to continue supporting newer Numpy versions. Personally I'd recommend refactoring the code to only rely on the public parts of the API to avoid similar problems in the future, as a better long-term solution.
I also came across this issue. As @Diapolo10 said, the _broadcast_shape
function still exists; it just got moved to a different file. Instead of reverting to an older Numpy version, I fixed the issue by commenting out the problematic import
statement in the reshape_fns.py
file and manually copied and pasted the _broadcast_shape
function from _stride_tricks_impl.py
into reshape_fns.py
. A better solution from the devs would still be appreciated.
Thanks. Fixed in 0.26.2
I installed 0.26.2 and did not run into this issue. I had another issue due to numpy version incompatibility but that was fixed by removing numpy and running pip install vectorbt
again and that installed a compatible version.
I'm having an import issue for past few days and still not able to solve it.
It's to do with importing _broadcast_shape from numpy.
Below is the error I get