teamtomo / membrain-seg

membrane segmentation in 3D for cryo-ET
Other
47 stars 12 forks source link

Error on membrain launch after following installation guide #70

Closed GenevieveBuckley closed 12 hours ago

GenevieveBuckley commented 1 week ago

Description

I followed the instructions in the installation guide, and all the packages appeared to install correctly with pip. But, when I tried to launch membrain from the command line, I got an error.

What I Did

git clone https://github.com/teamtomo/membrain-seg.git
cd membrain_seg
conda create -n membrainseg python=3.9 pip
conda activate membrainseg
pip install .
membrain
$ membrain

Traceback (most recent call last):
  File "/home/supervisor/miniforge3/envs/membrainseg/bin/membrain", line 5, in <module>
    from membrain_seg.segmentation.cli import cli
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/membrain_seg/segmentation/cli/__init__.py", line 5, in <module>
    from .segment_cli import segment  # noqa: F401
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/membrain_seg/segmentation/cli/segment_cli.py", line 12, in <module>
    from ..segment import segment as _segment
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/membrain_seg/segmentation/segment.py", line 17, in <module>
    from .dataloading.memseg_augmentation import get_mirrored_img, get_prediction_transforms
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/membrain_seg/segmentation/dataloading/memseg_augmentation.py", line 18, in <module>
    from membrain_seg.segmentation.dataloading.transforms import (
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/membrain_seg/segmentation/dataloading/transforms.py", line 608, in <module>
    AxesShuffle = Compose(
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/monai/transforms/compose.py", line 251, in __init__
    self.set_random_state(seed=get_seed())
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/monai/transforms/compose.py", line 263, in set_random_state
    _transform.set_random_state(seed=self.R.randint(MAX_SEED, dtype="uint32"))
  File "/home/supervisor/miniforge3/envs/membrainseg/lib/python3.9/site-packages/monai/transforms/transform.py", line 207, in set_random_state
    _seed = _seed % MAX_SEED
OverflowError: Python integer 4294967296 out of bounds for uint32

Additional info

conda list (click to expand) ``` # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge aiohttp 3.9.5 pypi_0 pypi aiosignal 1.3.1 pypi_0 pypi async-timeout 4.0.3 pypi_0 pypi attrs 23.2.0 pypi_0 pypi bzip2 1.0.8 hd590300_5 conda-forge ca-certificates 2024.6.2 hbcca054_0 conda-forge click 8.1.7 pypi_0 pypi filelock 3.15.3 pypi_0 pypi frozenlist 1.4.1 pypi_0 pypi fsspec 2024.6.0 pypi_0 pypi idna 3.7 pypi_0 pypi imageio 2.34.1 pypi_0 pypi jinja2 3.1.4 pypi_0 pypi lazy-loader 0.4 pypi_0 pypi ld_impl_linux-64 2.40 hf3520f5_7 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 13.2.0 h77fa898_11 conda-forge libgomp 13.2.0 h77fa898_11 conda-forge libnsl 2.0.1 hd590300_0 conda-forge libsqlite 3.46.0 hde9e2c9_0 conda-forge libuuid 2.38.1 h0b41bf4_0 conda-forge libxcrypt 4.4.36 hd590300_1 conda-forge libzlib 1.3.1 h4ab18f5_1 conda-forge lightning-utilities 0.11.2 pypi_0 pypi markdown-it-py 3.0.0 pypi_0 pypi markupsafe 2.1.5 pypi_0 pypi mdurl 0.1.2 pypi_0 pypi membrain-seg 0.0.2 pypi_0 pypi monai 1.3.1 pypi_0 pypi mpmath 1.3.0 pypi_0 pypi mrcfile 1.5.0 pypi_0 pypi multidict 6.0.5 pypi_0 pypi ncurses 6.5 h59595ed_0 conda-forge networkx 3.2.1 pypi_0 pypi numpy 2.0.0 pypi_0 pypi nvidia-cublas-cu12 12.1.3.1 pypi_0 pypi nvidia-cuda-cupti-cu12 12.1.105 pypi_0 pypi nvidia-cuda-nvrtc-cu12 12.1.105 pypi_0 pypi nvidia-cuda-runtime-cu12 12.1.105 pypi_0 pypi nvidia-cudnn-cu12 8.9.2.26 pypi_0 pypi nvidia-cufft-cu12 11.0.2.54 pypi_0 pypi nvidia-curand-cu12 10.3.2.106 pypi_0 pypi nvidia-cusolver-cu12 11.4.5.107 pypi_0 pypi nvidia-cusparse-cu12 12.1.0.106 pypi_0 pypi nvidia-nccl-cu12 2.20.5 pypi_0 pypi nvidia-nvjitlink-cu12 12.5.40 pypi_0 pypi nvidia-nvtx-cu12 12.1.105 pypi_0 pypi openssl 3.3.1 h4ab18f5_0 conda-forge packaging 24.1 pypi_0 pypi pandas 2.2.2 pypi_0 pypi pillow 10.3.0 pypi_0 pypi pip 24.0 pyhd8ed1ab_0 conda-forge pygments 2.18.0 pypi_0 pypi python 3.9.19 h0755675_0_cpython conda-forge python-dateutil 2.9.0.post0 pypi_0 pypi pytorch-lightning 2.3.0 pypi_0 pypi pytz 2024.1 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi readline 8.2 h8228510_1 conda-forge rich 13.7.1 pypi_0 pypi scikit-image 0.24.0 pypi_0 pypi scipy 1.13.1 pypi_0 pypi setuptools 70.1.0 pyhd8ed1ab_0 conda-forge shellingham 1.5.4 pypi_0 pypi simpleitk 2.3.1 pypi_0 pypi six 1.16.0 pypi_0 pypi sympy 1.12.1 pypi_0 pypi tifffile 2024.6.18 pypi_0 pypi tk 8.6.13 noxft_h4845f30_101 conda-forge torch 2.3.1 pypi_0 pypi torchmetrics 1.4.0.post0 pypi_0 pypi tqdm 4.66.4 pypi_0 pypi triton 2.3.1 pypi_0 pypi typer 0.12.3 pypi_0 pypi typing-extensions 4.12.2 pypi_0 pypi tzdata 2024.1 pypi_0 pypi wheel 0.43.0 pyhd8ed1ab_1 conda-forge xz 5.2.6 h166bdaf_0 conda-forge yarl 1.9.4 pypi_0 pypi ```
xingxingjiukunkun commented 6 days ago

"Have you resolved this issue? I am encountering the same problem."

GenevieveBuckley commented 4 days ago

"Have you resolved this issue? I am encountering the same problem."

I found changing line 207 in monai.transforms.transform.py to

_seed = int(_seed) % MAX_SEED

fixed the problem for me. You may like to install an editable version of the MONAI dependency and do the same until a proper fix is available.

See https://github.com/Project-MONAI/MONAI/pull/7871

GenevieveBuckley commented 3 days ago

According to one of the MONAI devs downgrading numpy to v1 (instead of v2) will also fix things.

LorenzLamm commented 2 days ago

Thanks a lot @GenevieveBuckley for reporting this issue and even fixing it! I also encountered other issues -- it seems like numpy v2 has not arrived everywhere yet. I just set the dependency of numpy to <2.0.0 (https://github.com/teamtomo/membrain-seg/pull/72) and this will hopefully resolve this.

kevinyamauchi commented 2 days ago

Thanks for all of the sleuthing, @GenevieveBuckley ! It's nice to see you here 😄

LorenzLamm commented 12 hours ago

As commented by @GenevieveBuckley in https://github.com/teamtomo/membrain-seg/pull/72#issuecomment-2192883229, this problem seems to be solved for now, so I'm closing this issue.

Thanks a lot again for the fix and quick feedback @GenevieveBuckley :)