pySPM icon indicating copy to clipboard operation
pySPM copied to clipboard

pySPM support under Python 3.13

Open ns-rse opened this issue 1 year ago • 2 comments

Describe the bug

pySPM depends on skimage<0.21.0,>=0.20.0 which are from 2023.

However under Python 3.13 this results in the issue described at KeyError in _regionprops.py during Documentation Installation (debug) in Python 3.13 · Issue #7585 · scikit-image/scikit-image.

Traceback of attempting to load the module is...

❱ python3 -m righttyper -m pytest --continue-on-collection-errors
ImportError while loading conftest '/home/neil/work/git/hub/AFM-SPM/AFMReader/tests/conftest.py'.
tests/conftest.py:5: in <module>
    import pySPM
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/pySPM/__init__.py:7: in <module>
    from . import align, utils
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/pySPM/align.py:17: in <module>
    from skimage import transform as tf
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/lazy_loader/__init__.py:79: in __getattr__
    return importlib.import_module(f"{package_name}.{name}")
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/transform/__init__.py:4: in <module>
    from .radon_transform import (radon, iradon, iradon_sart,
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/transform/radon_transform.py:6: in <module>
    from ._warps import warp
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/transform/_warps.py:7: in <module>
    from ..measure import block_reduce
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/measure/__init__.py:3: in <module>
    from ._regionprops import (regionprops, perimeter,
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/measure/_regionprops.py:1358: in <module>
    _install_properties_docs()
/home/neil/.virtualenvs/afmreader/lib/python3.13/site-packages/skimage/measure/_regionprops.py:1353: in _install_properties_docs
    getattr(RegionProperties, p).__doc__ = prop_doc[p]
E   KeyError: 'area'

As noted in that issue it is resolved in skimage>=0.25.0 which was released 2024-12-13

Would be great if the pinned dependency on skimage could be removed so Python 3.13 can be supported.

ns-rse avatar Jan 07 '25 10:01 ns-rse

where do you see the dependency skimage<0.21.0,>=0.20.0 ? I see this in pyproject.toml:

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
scikit-learn = "^1.2.2"
scikit-image = ">=0.21.0"

scholi avatar Jun 05 '25 18:06 scholi

Not sure what I was doing there. I do recall having issues with pySPM under Python 3.13 previously but have just checked and it installs ok which is weird given the python = ">=3.10,<3.13"

(tmp-72d2bc5fe14015) ❱ python --version
Python 3.13.3

(tmp-72d2bc5fe14015) ❱ pip show pyspm  
Name: pyspm
Version: 0.3.4
Summary: Library to handle SPM and ToF-SIMS data
Home-page: https://github.com/scholi/pySPM
Author: Olivier Scholder
Author-email: [email protected]
License: Apache-2.0
Location: /home/neil/.virtualenvs/tmp-72d2bc5fe14015/lib/python3.13/site-packages
Requires: ipython, matplotlib, numpy, psutil, pywavelets, scikit-image, scikit-learn, seaborn, tqdm
Required-by: 

I couldn't load the file Bruker file I reported in #56 though. Not working on this project today but will investigate when back on it next week.

ns-rse avatar Jun 13 '25 08:06 ns-rse