If sphere fitting is attempted with less than 4 points, this line will fail with the error message: "ValueError: Sample larger than population or is negative".
This could be improved with a simple check on the number of points and a more clear error message. Here's one possible fix.