weigertlab / trackastra

BSD 3-Clause "New" or "Revised" License
53 stars 12 forks source link

Requires python 3.10 #1

Closed mimuelle closed 5 months ago

mimuelle commented 5 months ago

Hi, really excited to give this new tracking algorithm a try!

I tried installing it into a conda environment with python 3.9 but got the following error when running the exemplary code:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[8], line 4
      1 import torch 
      3 from trackastra.utils import normalize
----> 4 from trackastra.model import Trackastra
      5 from trackastra.tracking import graph_to_ctc, graph_to_napari_tracks
      6 from trackastra.data import test_data_bacteria

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/model/__init__.py:4](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/model/__init__.py#line=3)
      1 # ruff: noqa: F401
      3 from .model import TrackingTransformer
----> 4 from .model_api import Trackastra

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/model/model_api.py:10](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/model/model_api.py#line=9)
      7 from pydantic import validate_call
      8 from tqdm import tqdm
---> 10 from ..data import build_windows, get_features
     11 from ..tracking import build_graph, track_greedy
     12 from ..utils import normalize

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/__init__.py:4](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/__init__.py#line=3)
      1 # ruff: noqa: F401
      3 from .augmentations import AugmentationPipeline, RandomCrop
----> 4 from .data import (
      5     CTCData,
      6     _ctc_lineages,
      7     # load_ctc_data_from_subfolders,
      8     collate_sequence_padding,
      9     extract_features_regionprops,
     10 )
     11 from .example_data import example_data_bacteria, example_data_fluo_3d, example_data_hela
     12 from .sampler import (
     13     BalancedBatchSampler,
     14     BalancedDataModule,
     15     BalancedDistributedSampler,
     16 )

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/data.py:23](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/data.py#line=22)
     20 from tqdm import tqdm
     22 from ..utils import blockwise_sum, normalize
---> 23 from . import wrfeat
     24 from ._check_ctc import _check_ctc, _get_node_attributes
     25 from .augmentations import AugmentationPipeline, RandomCrop

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/wrfeat.py:21](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/wrfeat.py#line=20)
     18 from skimage.measure import regionprops, regionprops_table
     19 from tqdm import tqdm
---> 21 from trackastra.data.utils import load_tiff_timeseries
     23 logger = logging.getLogger(__name__)
     25 _PROPERTIES = {
     26     "regionprops": (
     27         "area",
   (...)
     38     ),
     39 }

File [~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/utils.py:19](http://localhost:8888/lab/tree/Documents/20240417_viral_aneuploidy_analysis_mitosis_sisterCellLinking/SCRIPTS/~/opt/anaconda3/envs/20240529_testing_new_tracking_weigert/lib/python3.9/site-packages/trackastra/data/utils.py#line=18)
     11 from tqdm import tqdm
     13 logger = logging.getLogger(__name__)
     16 @validate_call
     17 def load_tiff_timeseries(
     18     dir: Path,
---> 19     dtype: str | type | None = None,
     20     downscale: tuple[int, ...] | None = None,
     21     start_frame: int = 0,
     22     end_frame: int | None = None,
     23 ) -> np.ndarray:
     24     """Loads a folder of `.tif` or `.tiff` files into a numpy array.
     25     Each file is interpreted as a frame of a time series.
     26 
   (...)
     35         np.ndarray: The loaded data.
     36     """
     37     # TODO make safe for label arrays

TypeError: unsupported operand type(s) for |: 'type' and 'type'

I think this is related to an issue with python < 3.10, therefore I created a new environment with python=3.10 and installed everything again. Now it's running without any issues! So maybe good to indicate python >= 3.10 in the instructions (currently it says python >= 3.9).

Also, the installation of napari will not install PyQt5 which means that no napari viewer window will open (without an error message). Maybe also worth mentioning in the installation instructions to install PyQt5 (or put it in the dependencies)?

The tracking results are really nice, thanks a lot for creating this new resource!

maweigert commented 5 months ago

Hi @mimuelle ,

This should be fixed in c8b8380. Thanks for the bug report and hope trackastra will be useful for you - any feedback is very welcome!