Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19835#discussion_r153552951
  
    --- Diff: python/pyspark/ml/image.py ---
    @@ -146,7 +163,11 @@ def toImage(self, array, origin=""):
                 mode = ocvTypes["CV_8UC4"]
             else:
                 raise ValueError("Invalid number of channels")
    -        data = bytearray(array.astype(dtype=np.uint8).ravel())
    +
    +        # Running `bytearray(numpy.array([1]))` fails in specific Python 
versions,
    +        # for example in Python 3.6.0. Here, it avoids it by wrapping an 
iter.
    +        data = bytearray(iter(array.astype(dtype=np.uint8).ravel()))
    --- End diff --
    
    To be honest, I can't find the exact issue and changes about this issue 
yet. There are too many similar issues in NumPy and Python release notes, and 
it sounds even harder to find the relevant issue as the exception is from NumPy 
but the cause seems a different Python version (3.6.0), if I haven't missed 
something.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to