Closed ffigueiredo85 closed 8 months ago
Hi Francisco,
how did you setup TomoTwin? By following the installation instructions? Because it seems like that you are using python 3.11. If you follow the installation instructions you should end up with python 3.10 and cuml etc installed.
Best, Thorsten
PS: Can you try to install TomoTwin by using a fresh environment? To that, you need to first remove the old environment with mamba env remove -n tomotwin
Hi Thorsten,
Thank you very much for your valuable feedback. I passed this information to our IT people that manage our servers. I hope it runs. Once again,
Thank you
Hi Thorsten,
Our IT department was able to put TomoTwin to work with python 3.10 and cuml installed. The UMAP estimates work perfectly, however, in the next step Finding the target clusters, after identifying the clustered points when I try to change the slice of the tomogram this error appears:
And all the highlighted regions disappear.
This is the same error Jesse reported in the other thread with the older version of TomoTwin.
‘numpy.float64’ object cannot be interpreted as an integer
Any idea what could be happening here?
Best,
Francisco
Can you show me the exact stacktrace? I can't reproduce any of those issues. The problem in jesses case is probably, that he somehow installed Napari 0.4.18 insated of 0.4.17. 18 contains breaking changes that gonna be fixed with the next napari release.
Here it is:
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/_qt/widgets/qt_dims_slider.py:142, in QtDimSliderWidget._value_changed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/components/dims.py:290, in Dims.set_current_step(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....4), order=(0, 1, 2), axis_labels=('0', '1', '2')), axis=0, value=131) 288 full_current_step = list(self.current_step) 289 full_current_step[axis] = step --> 290 self.current_step = full_current_step full_current_step = [131, 359, 254] self.current_step = (131, 359, 254) self = Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 250.0, 1.0), (0.0, 720.0, 1.0), (0.0, 510.0, 1.0)), current_step=(131, 359, 254), order=(0, 1, 2), axis_labels=('0', '1', '2')) 291 else: 292 full_current_step = list(self.current_step)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/evented_model.py:326, in EventedModel.setattr(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....4), order=(0, 1, 2), axis_labels=('0', '1', '2')), name='current_step', value=[131, 359, 254]) 323 if areequal(after, before): 324 # no change 325 return --> 326 emitter(value=after) # emit event emitter = <napari.utils.events.event.EventEmitter object at 0x7f3beba13160> after = (131, 359, 254) 328 # emit events for any dependent computed properties as well 329 for dep, value in before_deps.items():
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:768, in EventEmitter.call(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:806, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/utils/events/event.py:795, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/components/viewer_model.py:393, in ViewerModel._update_layers(self=Viewer(camera=Camera(center=(0.0, 359.5, 254.5),...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}), layers=[<Image layer 'L2_3_002_bin8pix10' at 0x7f3b3450... layer 'cluster_ids_in_space' at 0x7f3b1022a5c0>])
391 layers = layers or self.layers
392 for layer in layers:
--> 393 layer._slice_dims(
layer = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0>
self.dims.order = (0, 1, 2)
self = Viewer(camera=Camera(center=(0.0, 359.5, 254.5), zoom=0.8958761467889909, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(131.0, 856.2204250238916, 754.5691151505343), scaled=True, size=10, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 250.0, 1.0), (0.0, 720.0, 1.0), (0.0, 510.0, 1.0)), current_step=(131, 359, 254), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'L2_3_002_bin8pix10' at 0x7f3b3450fd30>, <Labels layer '...x10_embeddings_label_mask.mrci' at 0x7f3b138f93c0>, <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0>], help='use <1> for activate the label eraser, use <2> for activate the paint brush, use <3> for activate the fill bucket, use <4> for pick mode', status={'layer_base': 'L2_3_002_bin8pix10_embeddings_label_mask.mrci', 'source_type': 'plugin', 'plugin': 'Box Manager', 'coordinates': ' [131 856 755]'}, tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[<function load_umap.
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1076, in Layer._slice_dims(self=<Labels layer 'cluster_ids_in_space'>, point=(131.0, 359.0, 254.0), ndisplay=2, order=(0, 1, 2)) 1073 self._slice_input = slice_input 1075 # Update the point values -> 1076 self.refresh() self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0> 1077 self._reset_editable()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1264, in Layer.refresh(self=<Labels layer 'cluster_ids_in_space'>, event=None) 1262 """Refresh all layer data based on current view slice.""" 1263 if self.visible: -> 1264 self.set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0> 1265 self.events.set_data() 1266 self._update_thumbnail()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1029, in Layer.set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 1027 def set_view_slice(self): 1028 with self.dask_optimized_slicing(): -> 1029 self._set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0>
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:834, in _ImageBase._set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 830 # Load our images, might be sync or async. 831 data = self._SliceDataClass( 832 self, image_indices, image, thumbnail_source 833 ) --> 834 self._load_slice(data) data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f3bea6fec50> self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0> 835 if self._should_calc_clims: 836 self.reset_contrast_limits_range()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:862, in _ImageBase._load_slice(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:886, in _ImageBase._on_data_loaded(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:144, in ImageSlice.on_loaded(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:102, in ImageSlice._set_raw_images(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/_image_view.py:78, in ImageView.raw(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/image/image.py:1120, in _weakref_hide._raw_to_displayed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:999, in Labels._raw_to_displayed(self=<Labels layer 'cluster_ids_in_space'>, raw=<class 'numpy.ndarray'> (720, 510) uint64, data_slice=(slice(0, 720, None), slice(0, 510, None))) 996 if labels_to_map.size == 0: 997 return self._cached_mapped_labels[data_slice] --> 999 mapped_labels = self._map_labels_to_colors(labels_to_map) labels_to_map = <class 'numpy.ndarray'> (8108,) uint64 self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0> 1001 if update_mask is not None: 1002 self._cached_mapped_labels[data_slice][update_mask] = mapped_labels
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:1036, in Labels._map_labels_to_colors(self=<Labels layer 'cluster_ids_in_space'>, labels_to_map=<class 'numpy.ndarray'> (8108,) uint64) 1030 none_color_index = self._label_color_index[None] 1032 if upper_bound_n_unique_labels < 65536: 1033 mapping = np.array( 1034 [ 1035 self._label_color_index.get(label_id, none_color_index) -> 1036 for label_id in range(min_label_id, max_label_id + 1) np = <module 'numpy' from '/mnt/nfs/clustersw/Debian/bullseye/napari/0.4.18-py310/lib/python3.10/site-packages/numpy/init.py'> none_color_index = 0.5 self = <Labels layer 'cluster_ids_in_space' at 0x7f3b1022a5c0> self._label_color_index = {0: 0.16666667, 2: 0.8333334, None: 0.5} min_label_id = 0 max_label_id = 2 1037 ] 1038 ) 1039 mapped_labels = mapping[labels_to_map - min_label_id] 1040 else:
TypeError: 'numpy.float64' object cannot be interpreted as an integer`
Probably same reason as with Jesse: You are using napari 0.4.18 instead of 0.4.17
Have you followed the installation instructions by using mamba? Or you try to install it natively on cluster?
I highly recommend to use mamba and integrate it in your module system. Analog to the description given for crYOLO:
https://cryolo.readthedocs.io/en/stable/other/other.html#cryolo-integration-as-environment-module
Best, Thorsten
Once again, thank you for your feedback. I passed the information to our IT team. The Napari 0.4.17 is installed, but unfortunately the error persists:
`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/_qt/widgets/qt_dims_slider.py:142, in QtDimSliderWidget._value_changed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/components/dims.py:290, in Dims.set_current_step(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....4), order=(0, 1, 2), axis_labels=('0', '1', '2')), axis=0, value=134) 288 full_current_step = list(self.current_step) 289 full_current_step[axis] = step --> 290 self.current_step = full_current_step full_current_step = [134, 359, 254] self.current_step = (134, 359, 254) self = Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 250.0, 1.0), (0.0, 720.0, 1.0), (0.0, 510.0, 1.0)), current_step=(134, 359, 254), order=(0, 1, 2), axis_labels=('0', '1', '2')) 291 else: 292 full_current_step = list(self.current_step)
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/utils/events/evented_model.py:326, in EventedModel.setattr(self=Dims(ndim=3, ndisplay=2, last_used=0, range=((0....4), order=(0, 1, 2), axis_labels=('0', '1', '2')), name='current_step', value=[134, 359, 254]) 323 if areequal(after, before): 324 # no change 325 return --> 326 emitter(value=after) # emit event emitter = <napari.utils.events.event.EventEmitter object at 0x7f6d9739fca0> after = (134, 359, 254) 328 # emit events for any dependent computed properties as well 329 for dep, value in before_deps.items():
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/utils/events/event.py:768, in EventEmitter.call(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/utils/events/event.py:806, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/utils/events/event.py:795, in EventEmitter._invoke_callback(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/components/viewer_model.py:393, in ViewerModel._update_layers(self=Viewer(camera=Camera(center=(0.0, 352.0509610082...ouse_drag_gen={}, _mouse_wheel_gen={}, keymap={}), layers=[<Image layer 'L2_3_002_bin8pix10' at 0x7f6cce97... layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0>])
391 layers = layers or self.layers
392 for layer in layers:
--> 393 layer._slice_dims(
layer = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0>
self.dims.order = (0, 1, 2)
self = Viewer(camera=Camera(center=(0.0, 352.05096100824113, 286.81826215885934), zoom=1.1249673838161474, angles=(0.0, 0.0, 90.0), perspective=0.0, mouse_pan=True, mouse_zoom=True), cursor=Cursor(position=(134.0, 731.617555322664, 665.4959388189567), scaled=True, size=10, style=<CursorStyle.STANDARD: 'standard'>), dims=Dims(ndim=3, ndisplay=2, last_used=0, range=((0.0, 250.0, 1.0), (0.0, 720.0, 1.0), (0.0, 510.0, 1.0)), current_step=(134, 359, 254), order=(0, 1, 2), axis_labels=('0', '1', '2')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[<Image layer 'L2_3_002_bin8pix10' at 0x7f6cce9703a0>, <Labels layer '...x10_embeddings_label_mask.mrci' at 0x7f6cce1cd360>, <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0>], help='use <1> for activate the label eraser, use <2> for activate the paint brush, use <3> for activate the fill bucket, use <4> for pick mode', status={'layer_base': 'L2_3_002_bin8pix10_embeddings_label_mask.mrci', 'source_type': 'plugin', 'plugin': 'Box Manager', 'coordinates': ' [134 732 665]'}, tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_over_canvas=True, mouse_move_callbacks=[], mouse_drag_callbacks=[<function load_umap_magic.
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1076, in Layer._slice_dims(self=<Labels layer 'cluster_ids_in_space'>, point=(134.0, 359.0, 254.0), ndisplay=2, order=(0, 1, 2)) 1073 self._slice_input = slice_input 1075 # Update the point values -> 1076 self.refresh() self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0> 1077 self._reset_editable()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1264, in Layer.refresh(self=<Labels layer 'cluster_ids_in_space'>, event=None) 1262 """Refresh all layer data based on current view slice.""" 1263 if self.visible: -> 1264 self.set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0> 1265 self.events.set_data() 1266 self._update_thumbnail()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/base/base.py:1029, in Layer.set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 1027 def set_view_slice(self): 1028 with self.dask_optimized_slicing(): -> 1029 self._set_view_slice() self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0>
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/image.py:834, in _ImageBase._set_view_slice(self=<Labels layer 'cluster_ids_in_space'>) 830 # Load our images, might be sync or async. 831 data = self._SliceDataClass( 832 self, image_indices, image, thumbnail_source 833 ) --> 834 self._load_slice(data) data = <napari.layers.image._image_slice_data.ImageSliceData object at 0x7f6d875df7c0> self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0> 835 if self._should_calc_clims: 836 self.reset_contrast_limits_range()
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/image.py:862, in _ImageBase._load_slice(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/image.py:886, in _ImageBase._on_data_loaded(self=<Labels layer 'cluster_ids_in_space'>, data=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:144, in ImageSlice.on_loaded(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/_image_slice.py:102, in ImageSlice._set_raw_images(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/_image_view.py:78, in ImageView.raw(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/image/image.py:1120, in _weakref_hide._raw_to_displayed(self=
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:999, in Labels._raw_to_displayed(self=<Labels layer 'cluster_ids_in_space'>, raw=<class 'numpy.ndarray'> (720, 510) uint64, data_slice=(slice(0, 720, None), slice(0, 510, None))) 996 if labels_to_map.size == 0: 997 return self._cached_mapped_labels[data_slice] --> 999 mapped_labels = self._map_labels_to_colors(labels_to_map) labels_to_map = <class 'numpy.ndarray'> (10828,) uint64 self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0> 1001 if update_mask is not None: 1002 self._cached_mapped_labels[data_slice][update_mask] = mapped_labels
File /mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/napari/layers/labels/labels.py:1036, in Labels._map_labels_to_colors(self=<Labels layer 'cluster_ids_in_space'>, labels_to_map=<class 'numpy.ndarray'> (10828,) uint64) 1030 none_color_index = self._label_color_index[None] 1032 if upper_bound_n_unique_labels < 65536: 1033 mapping = np.array( 1034 [ 1035 self._label_color_index.get(label_id, none_color_index) -> 1036 for label_id in range(min_label_id, max_label_id + 1) np = <module 'numpy' from '/mnt/nfs/clustersw/Debian/bullseye/napari/0.4.17-py310/lib/python3.10/site-packages/numpy/init.py'> none_color_index = 0.5 self = <Labels layer 'cluster_ids_in_space' at 0x7f6c0ef5fcd0> self._label_color_index = {0: 0.16666667, 2: 0.8333334, None: 0.5} min_label_id = 0 max_label_id = 2 1037 ] 1038 ) 1039 mapped_labels = mapping[labels_to_map - min_label_id] 1040 else:
TypeError: 'numpy.float64' object cannot be interpreted as an integer`
I will try to answer if they used mamba for the installation.
mamba or conda should not play any role - its just how fast the the things get installed. But still, it does not look like a conda environment. Could you ask them to send your the list of packages they installed with:
conda activate napari-tomotwin
conda list >> packages_conda.txt
pip freeze >> packages_pip.txt
I would like to see both txt files.
I also tried to reproduce it. I open a umap, I select a region with a the lasso tool and then I use the slider. This way you get the error, right? For me everything works.
I'm sorry that you have so much trouble getting this running.
Thank you!
Here are the files: packages_conda.txt packages_pip.txt
That is correct about we get the error.
Thank you for the help!
Looking at your your conda file it tells me that you installed both napari and tomotwin in the same environment. Please tell your IT to follow the instructions and install it separately. Thanks :-)
Thank you! I passed that information. Hoping that it could be fixed easily.
A instruction to test if the installation of napari-tomotwin was successfully would be to follow the tutorial and not obtain any errors?
You should not see any errors, yes. Of course I can't promise that there are no bugs ^^
As there is no activity anymore, I hope this is solved. Otherwise reopen.
Hello!
I am using TomoTwin to analyze my tomograms and I am in the step of Estimate UMAP manifold and Generate Embedding Mask.
When I run the command for that: _tomotwin_tools.py umap -i .out/embed/tomo/tomoembeddings.temb -o out/clustering
I receive the following error:
_Traceback (most recent call last): File "/mnt/nfs/clustersw/Debian/bullseye/python/3.11.4/bin/tomotwin_tools.py", line 5, in
from tomotwin.tools_main import main
File "/mnt/nfs/clustersw/Debian/bullseye/python/3.11.4/lib/python3.11/site-packages/tomotwin/toolsmain.py", line 390, in
from tomotwin.modules.tools.umap import UmapTool
File "/mnt/nfs/clustersw/Debian/bullseye/python/3.11.4/lib/python3.11/site-packages/tomotwin/modules/tools/umap.py", line 7, in
import cuml
ModuleNotFoundError: No module named 'cuml'
We have updated TomoTwin to the latest version yesterday in our cluster, since this error was occurring before, but unfortunately it did not fix the issue.
Any suggestion to tackle this?
Thank you,
Francisco