HistomicsTK
HistomicsTK copied to clipboard
Installation issue on mac
I installed histomicstk using pip install histomicstk
then get the following error message when I try to import the package
from histomicstk.features import compute_morphometry_features
~/anaconda3/envs/comp_onc/lib/python3.8/site-packages/histomicstk/__init__.py in <module>
1 # import sub-packages to support nested calls
----> 2 from . import segmentation # must be imported before features
3 from . import utils # must be imported before other packages
4 from . import (annotations_and_masks, features, filters, preprocessing,
5 saliency, workflows)
~/anaconda3/envs/comp_onc/lib/python3.8/site-packages/histomicstk/segmentation/__init__.py in <module>
9
10 # import sub-packages to support nested calls
---> 11 from . import label, level_set, nuclear, positive_pixel_count
12 from .embed_boundaries import embed_boundaries
13 from .rag import rag
~/anaconda3/envs/comp_onc/lib/python3.8/site-packages/histomicstk/segmentation/label/__init__.py in <module>
16 from .shuffle import shuffle
17 from .split import split
---> 18 from .trace_object_boundaries import trace_object_boundaries
19 from .width_open import width_open
20
~/anaconda3/envs/comp_onc/lib/python3.8/site-packages/histomicstk/segmentation/label/trace_object_boundaries.py in <module>
1 import numpy as np
2
----> 3 from ._trace_object_boundaries_cython import _trace_object_boundaries_cython
4
5
_trace_object_boundaries_cython.pyx in init histomicstk.segmentation.label._trace_object_boundaries_cython()
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
I'm using python version 3.8.12, numpy version 1.20.3, macOS Big Sur Version 11.1.
Ok I upgraded numpy to version 1.22.3 and it now works. It might be useful to add a warning or comment around that import in histomicstk/segmentation/label/trace_object_boundaries.py
so people know to update numpy in case of this error.
Thanks. I'll see if I can narrow down the exact necessary version of numpy and just require that when on OSX.
@manthey I had the same issue when I installed histomicstk in a Singularity container built on debian, so I don't think it is OS-specific. I found this stack overflow thread which claims an update to the C API can cause problems when the build version of numpy is <1.20 and the installed version is >=1.20, but I'm not sure this is the same problem since I would expect upgrading to numpy 1.22.3 would not work if that were the case. I got the same ValueError trace using python 3.9.10 and numpy 1.21.2 but was also able to fix by upgrading to numpy 1.22.3. It looks like some other packages have had issues with the C binary change and numpy compatibility, there is additional info in this numpy issue thread that may be useful.