[SciPy-User] Baffling error: ndarray += csc_matrix -> "ValueError: setting an array element with a sequence"

Nathaniel Smith njs at pobox.com
Tue Sep 24 13:45:29 EDT 2013


Hi all,

I'm getting a very strange error, and unfortunately I can't seem to
reproduce it *except* when running on Travis-CI, so my debugging tools
are really limited. I'm wondering if anyone else has seen anything
like this?

The offending line of code is:

  File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/pyrerp/incremental_ls.py",
line 323, in append_bottom_half
    self.xtx += xtx
ValueError: setting an array element with a sequence.

And debug prints reveal that in the case that causes the error,
'self.xtx' is an ndarray that prints as:

[[ 0.  0.]
 [ 0.  0.]]

while 'xtx' is a scipy.sparse.csc.csc_matrix that prints as:

  (1, 0) 45.0
  (0, 0) 10.0
  (1, 1) 285.0
  (0, 1) 45.0

On my laptop (Ubuntu 12.10, 64-bit, numpy 1.7.1, scipy 0.12.0), the
same test passes fine. Travis is Ubuntu 12.04, 32-bit, numpy 1.7.1,
scipy 0.12.0, so I guess in *principle* it could be a 32-bit/64-bit
thing, but that's just a wild guess. Any ideas?

-n

P.S.: if anyone's curious, the full build log is here:
https://s3.amazonaws.com/archive.travis-ci.org/jobs/11735709/log.txt
and the code is here:
https://github.com/njsmith/pyrerp/blob/master/pyrerp/incremental_ls.py#L323



More information about the SciPy-User mailing list