DigitalSlideArchive / HistomicsTK

A Python toolkit for pathology image analysis algorithms.
https://digitalslidearchive.github.io/HistomicsTK/
Apache License 2.0
391 stars 117 forks source link

numpy breaks import #880

Closed gregmbi closed 2 years ago

gregmbi commented 4 years ago

I just spent half a day on this, seems like numpy > 1.17.5 is a bit broken, when installed it will break the simple import of this package. The solution is to install numpy==1.17.5 until this is fixed. Please update the install instructions accordingly

manthey commented 4 years ago

We've been testing with newer versions of numpy (depending on Python version). What OS and Python versions are you using?

For instance, the last CI build was with numpy 1.19.2 on Python 3.6, 3.7, and 3.8 and 1.18.5 on Python 3.5 (and, of course numpy 1.16.6 for Python 2.7, as that was the last version of numpy for 2.7).

gregmbi commented 4 years ago

Ubuntu 18.04, Python 3.6.9, this problem seems to occur in a few places, for example: https://github.com/NVlabs/few-shot-vid2vid/issues/31 the thing is its confusing as it happens when you try to import the HistomicsTK, so you think that the problem is with it ...

manthey commented 4 years ago

The issue you linked seems to be when passing a float to linspace, which expects an integer value. If you can cite a traceback where this occurs in HistomicsTK, we can guard against it. Looking at our code, I don't see any routes where that can happen.

gregmbi commented 3 years ago

Traceback (most recent call last): File "train.py", line 31, in <module> from histomicstk.preprocessing.color_deconvolution import color_deconvolution_routine File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/__init__.py", line 7, in <module> from . import segmentation # must be imported before features File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/segmentation/__init__.py", line 17, in <module> from . import nuclear File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/segmentation/nuclear/__init__.py", line 10, in <module> from .detect_nuclei_kofahi import detect_nuclei_kofahi File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/segmentation/nuclear/detect_nuclei_kofahi.py", line 4, in <module> import histomicstk.filters.shape as htk_shape_filters File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/filters/__init__.py", line 7, in <module> from . import shape File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/filters/shape/__init__.py", line 10, in <module> from .glog import glog File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/histomicstk/filters/shape/glog.py", line 7, in <module> range=np.linspace(1.5, 3.0, np.round((3.0 - 1.5) / 0.2) + 1.0), File "<__array_function__ internals>", line 6, in linspace File "/home/eri/cnvrg_env_phd_1_7/lib/python3.6/site-packages/numpy/core/function_base.py", line 113, in linspace num = operator.index(num) TypeError: 'numpy.float64' object cannot be interpreted as an integer

manthey commented 2 years ago

This was fixed a long time ago (in #766).