ajhynes7/scikit-spatial

error when using scikit-spatial=6..0.0 and ipython>7.17

Closed this issue · 4 comments

Hi,

Great repo! Thanks a lot!

I get an error with the newest release. If in a jupyer-notebook I try to create a Point the cell get stuck.
I don't get any error message from your library, the only error message is a warning that comes from ipython:

DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.

and to reproduce it the minimal code is:

from skspatial.objects import Point
Point([0, 0])

If I downgrade ipython below 7.17 or to scikit-spatial=5.2.0 everything works fine. My OS is manajro 21.0

best,

Lorenzo

Hi Lorenzo,

Thank you! I'm glad you like it.

I was able to reproduce this on my machine.
It might have something to do with this open issue: ipython/ipykernel#540.

I will look into it more soon. My suggestion for now would be to downgrade ipython, like you said.

Great! Thanks!

Just a quick follow up, I looked a bit deeper at at your suggestion and from jupyeter/notebook#5757 the issue seems the warnings.filterwarnings("error") so my guess is the error comes from here:

try:
warnings.filterwarnings("error")
np.array(array)

Good catch, I think you're right.

This fixed the issue for me. Can you check if it works for you? If so, I'll make a new release.

with warnings.catch_warnings():

    warnings.filterwarnings("error")

    try:
        np.array(array)

    except np.VisibleDeprecationWarning as error:
        if str(error).startswith("Creating an ndarray from ragged nested sequences"):
            raise ValueError("The array must not contain sequences with different lengths.")

Yes, it fixes it for me too, thanks a lot!