Regression in mpl: AttributeError: incompatible shape for a non-contiguous array
This error started showing up in the test suite for mpl when using numpy master. AttributeError: incompatible shape for a non-contiguous array The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g., offsets.shape = (-1, 2) Those lines haven't changed in a couple of years, and was intended to be done this way to raise an error when reshaping would result in a copy (since we needed to use the original in those places). I don't know how these arrays have become non-contiguous, so I am wondering if there was some sort of attribute that got screwed up somewhere (maybe with views?) Cheers! Ben Root
Hey, On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
This error started showing up in the test suite for mpl when using numpy master.
AttributeError: incompatible shape for a non-contiguous array
The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g.,
offsets.shape = (-1, 2)
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master? Regards, Sebastian
Those lines haven't changed in a couple of years, and was intended to be done this way to raise an error when reshaping would result in a copy (since we needed to use the original in those places). I don't know how these arrays have become non-contiguous, so I am wondering if there was some sort of attribute that got screwed up somewhere (maybe with views?)
Cheers! Ben Root _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg wrote: Hey, On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote: This error started showing up in the test suite for mpl when using
numpy master. AttributeError: incompatible shape for a non-contiguous array The tracebacks all point back to various code points where we are
trying to set the shape of an array, e.g., offsets.shape = (-1, 2) Could you give a hint what these arrays history (how it was created) and
maybe .shape/.strides is? Sounds like the array is not contiguous when
it is expected to be, or the attribute setting itself fails in some
corner cases on master? Regards, Sebastian The original reporter of the bug dug into the commit list and suspects it
was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean
rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets)
offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing
really all that special. I will see if I can get stride information.
Ben Root
Turns out it isn't the commit I thought it was. I'm currently going through
a git bisect to track down the actual commit that introduced this bug. I'll
post back when I've found it.
PTM
---
Patrick Marsh
Ph.D. Candidate / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root
On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg < sebastian@sipsolutions.net> wrote:
Hey,
On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
This error started showing up in the test suite for mpl when using numpy master.
AttributeError: incompatible shape for a non-contiguous array
The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g.,
offsets.shape = (-1, 2)
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master?
Regards,
Sebastian
The original reporter of the bug dug into the commit list and suspects it was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets) offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing really all that special. I will see if I can get stride information.
Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
I've tracked down the problem to this commit:
https://github.com/numpy/numpy/commit/c48156dfdc408f0a1e59ef54ac490cccbd6b8d...
Patrick.Marsh@buxton numpy> git bisect good
c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 is the first bad commit
commit c48156dfdc408f0a1e59ef54ac490cccbd6b8d73
Author: Sebastian Berg
Turns out it isn't the commit I thought it was. I'm currently going through a git bisect to track down the actual commit that introduced this bug. I'll post back when I've found it.
PTM --- Patrick Marsh Ph.D. Candidate / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root
wrote: On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg < sebastian@sipsolutions.net> wrote:
Hey,
On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
This error started showing up in the test suite for mpl when using numpy master.
AttributeError: incompatible shape for a non-contiguous array
The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g.,
offsets.shape = (-1, 2)
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master?
Regards,
Sebastian
The original reporter of the bug dug into the commit list and suspects it was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets) offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing really all that special. I will see if I can get stride information.
Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Thanks a lot! I feared it would have something to do with those changes, turns out I tried with the wrong numpy version. But at least its not in 1.7. for sure so nothing to worry about :). I will have a look at it. On Mon, 2012-10-29 at 10:15 -0500, Patrick Marsh wrote:
I've tracked down the problem to this commit: https://github.com/numpy/numpy/commit/c48156dfdc408f0a1e59ef54ac490cccbd6b8d...
Patrick.Marsh@buxton numpy> git bisect good c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 is the first bad commit commit c48156dfdc408f0a1e59ef54ac490cccbd6b8d73 Author: Sebastian Berg
Date: Sun Oct 21 18:50:28 2012 +0200 API: Change Flags Updateing to allow C-/F-contiguous arrays
This changes UpdateFlags to ignore 1-dimensional axis when setting C-/F-contiguous flags. Updates both flags always now.
--- Patrick Marsh Ph.D. Candidate / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 10:04 AM, Patrick Marsh
wrote: Turns out it isn't the commit I thought it was. I'm currently going through a git bisect to track down the actual commit that introduced this bug. I'll post back when I've found it. PTM --- Patrick Marsh Ph.D. Candidate / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root
wrote: On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg
wrote: Hey, On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote: > This error started showing up in the test suite for mpl when using > numpy master. > > AttributeError: incompatible shape for a non-contiguous array > > The tracebacks all point back to various code points where we are > trying to set the shape of an array, e.g., > > offsets.shape = (-1, 2) >
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master?
Regards,
Sebastian
The original reporter of the bug dug into the commit list and suspects it was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets) offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing really all that special. I will see if I can get stride information.
Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Mon, Oct 29, 2012 at 11:04 AM, Patrick Marsh
Turns out it isn't the commit I thought it was. I'm currently going through a git bisect to track down the actual commit that introduced this bug. I'll post back when I've found it.
PTM --- Patrick Marsh Ph.D. Candidate / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root
wrote: On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg < sebastian@sipsolutions.net> wrote:
Hey,
On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
This error started showing up in the test suite for mpl when using numpy master.
AttributeError: incompatible shape for a non-contiguous array
The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g.,
offsets.shape = (-1, 2)
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master?
Regards,
Sebastian
The original reporter of the bug dug into the commit list and suspects it was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets) offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing really all that special. I will see if I can get stride information.
Ben Root
Further digging reveals that the code fails when the array is originally 1-D. I had an array with shape (2,) and stride (8,). The reshaping should result in a shape of (1, 2).
Ben Root
I went ahead and filed a ticket (https://github.com/numpy/numpy/issues/2700)
for historical purposes…and so those on the MPL list can follow up.
PTM
---
Patrick Marsh
Ph.D. Candidate / Liaison to the HWT
School of Meteorology / University of Oklahoma
Cooperative Institute for Mesoscale Meteorological Studies
National Severe Storms Laboratory
http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 10:18 AM, Benjamin Root
On Mon, Oct 29, 2012 at 11:04 AM, Patrick Marsh
wrote: Turns out it isn't the commit I thought it was. I'm currently going through a git bisect to track down the actual commit that introduced this bug. I'll post back when I've found it.
PTM --- Patrick Marsh Ph.D. Candidate / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com
On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root
wrote: On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg < sebastian@sipsolutions.net> wrote:
Hey,
On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
This error started showing up in the test suite for mpl when using numpy master.
AttributeError: incompatible shape for a non-contiguous array
The tracebacks all point back to various code points where we are trying to set the shape of an array, e.g.,
offsets.shape = (-1, 2)
Could you give a hint what these arrays history (how it was created) and maybe .shape/.strides is? Sounds like the array is not contiguous when it is expected to be, or the attribute setting itself fails in some corner cases on master?
Regards,
Sebastian
The original reporter of the bug dug into the commit list and suspects it was this one:
https://github.com/numpy/numpy/commit/02ebf8b3e7674a6b8a06636feaa6c761fcdf4e...
However, it might be earlier than that (he is currently doing a clean rebuild to make sure).
As for the history:
offsets = np.asanyarray(offsets) offsets.shape = (-1, 2) # Make it Nx2
Where "offsets" comes in from (possibly) user-supplied data. Nothing really all that special. I will see if I can get stride information.
Ben Root
Further digging reveals that the code fails when the array is originally 1-D. I had an array with shape (2,) and stride (8,). The reshaping should result in a shape of (1, 2).
Ben Root
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Benjamin Root
-
Patrick Marsh
-
Sebastian Berg