pi3d / pi3d.github.com

Org page for pi3d
22 stars 7 forks source link

Broken with Pillow 10.x #11

Closed m4r35n357 closed 12 months ago

m4r35n357 commented 1 year ago

I'm pretty sure the problem is this: https://github.com/python-pillow/Pillow/issues/7322

Traceback (most recent call last):
  File "/home/ian/projects/ODE-Python/./plot3d.py", line 139, in <module>
    main()
  File "/home/ian/projects/ODE-Python/./plot3d.py", line 59, in main
    font = Font('/usr/share/fonts/truetype/liberation2/LiberationMono-Regular.ttf', color='green', codepoints='-0123456789. txyz:=+', font_size=18)
  File "/home/ian/.virtualenvs/taylor/lib/python3.9/site-packages/pi3d/util/Font.py", line 168, in __init__
    chwidth, chheight = imgfont.getsize(ch)
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
paddywwoof commented 1 year ago

Hi @m4r35n357 I'll have a look at that now. I've got another fix in the pipeline - just waiting for the excruciatingly slow reinstatement of 2FA on my PYPI account!!! Paddy

m4r35n357 commented 1 year ago

Cheers, Paddy, I can work round this of course, the only reason I noticed was on a new install when I set up my venv. The real problem lies with Pip and the Python "ecosystem" IMO - you just don't know what you are going to get unless you specify all your dependency versions manually, and there are pitfalls with that too.

paddywwoof commented 1 year ago

Hi, I've pushed a mod https://github.com/tipam/pi3d/commit/d5695b27cd1917fa267c88be19f901964346b22d which seems to work (after I upgraded PIL on this desktop. I will run it on a Raspberry Pi later just to be on the safe side)

I agree about the terrible mish-mash of the python ecosystem. On this desktop only root has permission access the mouse device until I add it to a relevant sudo group, however numpy hasn't been installed for root, only for userX, PIL, of course is installed with version 9.x for root but now 10.0.1 for userX. Some were apt installed from debian, others pip --upgrade. Nightmare. At least the py2 v py3 debacle has receded to all intents and purposes.

If I get permission to use my PYPI account today I will push the pip version of pi3d to 2.50. Otherwise I won't get chance for a couple of weeks. Oh well.

Paddy

m4r35n357 commented 1 year ago

OK thanks!

I always use virtual environments to avoid the system/user installation pitfall, and thought I was safe at first, but even so a few times I've been caught out with "transient versions" (also local builds failing because I haven't got build dependencies installed on the new machine!). Matplotlib and numpy seem to be the worst offenders.

paddywwoof commented 1 year ago

Yes virtual environments and containerizing things is probably much safer, however I try to keep my setup as unsophisticated as possible so that I run into any problems that the average, not so experienced user might find! PS just found that Image.ANTIALIAS has changed to Image.LANCZOS so pushed another mod!

m4r35n357 commented 12 months ago

working with 2.51, but I expect you know this ;)

paddywwoof commented 12 months ago

Thanks for pointing it out in the first place.