enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

ENH: Add support for 3.11 #1199

Closed larsoner closed 1 year ago

larsoner commented 1 year ago

Closes https://github.com/enthought/mayavi/issues/1188

First step, show the failure from https://github.com/conda-forge/mayavi-feedstock/pull/70

larsoner commented 1 year ago

No VTK wheels on PyPI yet so this can't move forward without using conda-forge or similar.

Also I'm not sure any changes are actually needed at the Mayavi end to support Python 3.11 -- perhaps just a newer version of Cython (with 3.11 compat) that generates 3.11-compatible code will fix things. I'll close for now...

larsoner commented 1 year ago

Okay from working on https://github.com/conda-forge/mayavi-feedstock/pull/70 it's clear that tvtk/src/array_ext.c needs to be regenerated with a newer Cython version. I've done that using 0.29.32

larsoner commented 1 year ago

Okay this looks good to go now! Using the array_ext.c in https://github.com/conda-forge/mayavi-feedstock/pull/70 everything seems to pass on 3.11

larsoner commented 1 year ago

Things fail with the latest PyPI 9.2.5, I'll push a commit here to test it which should fail, then I'll fix it

larsoner commented 1 year ago

Task failed successfully:

Instantiating <class 'vtkmodules.vtkFiltersFlowPaths.vtkLagrangianParticleTracker'>
    Calling vtkLagrangianParticleTracker.GetCellLengthComputationMode()
  Fatal Python error: Segmentation fault

time to push the fix

larsoner commented 1 year ago

There appears to be a 3.11 bug with traits now somewhere:

_________________________ TestArraySource.test_pickle __________________________
mayavi/tests/test_array_source.py:158: in test_pickle
    data = pickle.dumps(d)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/traits/has_traits.py:1380: in __reduce_ex__
    return (__newobj__, (self.__class__,), self.__getstate__())
mayavi/core/base.py:174: in __getstate__
    return state_pickler.dumps(self)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:968: in dumps
    return StatePickler().dumps(value)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:308: in dumps
    return pickle.dumps(self._do(value))
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:358: in _do
    return self._do_instance(obj)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:410: in _do_instance
    data = self._do(state)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:347: in _do
    return self.type_map[obj_type](obj)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:461: in _do_dict
    vals = [self._do(x) for x in value.values()]
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:461: in <listcomp>
    vals = [self._do(x) for x in value.values()]
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:347: in _do
    return self.type_map[obj_type](obj)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:461: in _do_dict
    vals = [self._do(x) for x in value.values()]
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:461: in <listcomp>
    vals = [self._do(x) for x in value.values()]
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:358: in _do
    return self._do_instance(obj)
/opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/apptools/persistence/state_pickler.py:403: in _do_instance
    state.pop("__traits_version__", None)
E   AttributeError: 'NoneType' object has no attribute 'pop'

I'll revert the CIs testing 3.11 for now...

larsoner commented 1 year ago

Okay, this is once again ready for review/merge from my end, and you can see the conda-forge build succeed in https://github.com/conda-forge/mayavi-feedstock/pull/71

pmav99 commented 1 year ago

Great! Any ideas about when a release is going to be made?

prabhuramachandran commented 1 year ago

I would want to spend a bit more time fixing any other breakages and resolve #1228 before a release.

pmav99 commented 1 year ago

Thanks for the heads up.