I was getting the same error but then I noticed that I was printing my np array for debugging and had not removed that line. The error was coming to that print apparently. It went away when I removed the print