tabreturn / thonny-py5mode

A py5 plug-in for Thonny
Do What The F*ck You Want To Public License
23 stars 8 forks source link

simple sketches fail because of np.float_ in the included file vector.py #58

Closed thoschneider closed 2 months ago

thoschneider commented 2 months ago

The first example sketch shown in README.md (and other simple sketches) do not work at all! (I followed the installation instructions in README.md). After hitting the play-button it raises an error:

AttributeError: np.float_ was removed in the NumPy 2.0 release. Use np.float64 instead.. Did you mean: 'float16'?

I assume a newer version of vector.py should be included. If I replace all" np.float_" in vector.py with "np.float64" as suggested in the error message my sketches run as expected.

hx2A commented 2 months ago

What version of py5 are you using? The latest version of py5 set a numpy dependency of < 2.0. Earlier versions of py5 do not have that dependency limitation. You should not yet use py5 with numpy 2.0 until library maintainers have a chance to upgrade their libraries to work with the new version of py5. I suspect a lot of libraries will not work with numpy 2.0 and that maintainers need a chance to test and make updates.

thoschneider commented 2 months ago

Thanks! I followed the instructions in README. I installed thonny-py5mode without prior py5 installation. This resulted in py5 version 0.8.0a2

What I found out now: Thonny version 4.1.4 (as recommended in README) comes with numpy 2.0 already!

Probably a downgrade to numpy < 2 beforehand does the trick.

I got it working by FIRST installing py5 (in version 0.10.1a1). Afterwards I installed thonny-py5mode. This resulted in a downgrade of py5 to version 0.8.0a2. As I know now installing the latest py5 version resulted also in numpy < 2 ...

Is it possible to add a numpy < 2 dependency to the thonny-py5mode plugin so others won't struggle with this issue? Or at least a comment in README? Unfortunately at the moment the install instructions do not work out of the box.

hx2A commented 2 months ago

@thoschneider , glad you have it working!

Is it possible to add a numpy < 2 dependency to the thonny-py5mode plugin so others won't struggle with this issue? Or at least a comment in README? Unfortunately at the moment the install instructions do not work out of the box.

Yes, this is an important issue. @tabreturn & @villares , what can we do about this? Can we do a plugin release with these changes?

villares commented 2 months ago

Yeah, it would be great if we could provide a new plug-in release changing this.

I have been instructing my students to install Thonny, then install py5 and then install the plug-in. And when on Windows, to use the "portable" available at this dropbox which might be o py5 10.0.0. Yeah, not ideal....

@thoschneider, could you please report on which OS/platform you are using? I have not seen before the behavior you described of the plug-in triggering a py5 downgrade, I'm very worried about this.

thoschneider commented 2 months ago

A student of mine had this problem on a windows machine. I figured it out on a virtual windows 10 machine.

Concerning the downgrade: In setup.py I read "install_requires=[ 'install-jdk==1.1.0', 'py5>=0.8.0a2', 'pyclip==0.7.0' ]" but in Thonny plugin-manager it says py5==0.8.0a2 !

villares commented 2 months ago

@thoschneider it is just a hunch, but following the instructions to install py5 via Thonny's the "Manage packages..." interface, and the plug-in via the "Manage plug-ins..." panel, defeats the plug-in attempt to enforce the py5 version. Maybe the student installed both using the "Manage plug-ins" panel, which, in my experience, leads to pain and disaster :(

If you have the chance, check if the portable works for them.

thoschneider commented 2 months ago

If you have the chance, check if the portable works for them.

I'll do this. Thanks! But it seems, that downgrading numpy to <2 works as well.

thoschneider commented 2 months ago

Maybe the student installed both using the "Manage plug-ins"

This is what I did, when messing around, to find out, what is going on ;) Good to know, that it does not happen, when using the package manager for py5. So you don't have to worry anymore...

Nevertheless, an update of the install instruction would be great! Either an advice to install py5 first and the plugin afterwards - as you suggested - and/or to make sure, that numpy version is <2.