SINTEF / Splipy

Spline modelling made easy.
GNU General Public License v3.0
100 stars 18 forks source link

Scripts in example folder fail in python 3.12 #171

Open VikingScientist opened 4 months ago

VikingScientist commented 4 months ago

In particular reuleaux.py fails with

/home/kjetijo/Projects/splipy/examples/reuleaux.py:33: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()
Traceback (most recent call last):
  File "/home/kjetijo/Projects/splipy/examples/reuleaux.py", line 46, in <module>
    ax = plt.figure().gca(projection='3d')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: FigureBase.gca() got an unexpected keyword argument 'projection'

and lissajous.py fails with

Traceback (most recent call last):
  File "/home/kjetijo/Projects/splipy/examples/lissajous.py", line 15, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.12/fractions.py)

and circle_animation.py fails at

/home/kjetijo/Projects/splipy/examples/circle_animation.py:40: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
  plt.show()
/home/kjetijo/venvs/splipy312/lib/python3.12/site-packages/matplotlib/animation.py:892: UserWarning: Animation was deleted without rendering anything. This is most likely not intended. To prevent deletion, assign the Animation to a variable, e.g. `anim`, that exists until you output the Animation using `plt.show()` or `anim.save()`.

Ideally all of these codes (as well as any example codes in the documentation) should be run as part of the CI test suite system.

TheBB commented 4 months ago

I have fixed lissajous. The releaux script has more to do with the version of Matplotlib than with Python, but I've fixed that too.

I can't reproduce your circle_animation error, but it looks like you need to make sure you have a better Matplotlib backend installed, or if you have one installed, make sure Matplotlib uses it.

https://github.com/SINTEF/Splipy/pull/172

TheBB commented 4 months ago

Keeping this open for doctests.