question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MONAI Label doesn't work with torch<=1.10.0

See original GitHub issue

Describe the bug

After the PR https://github.com/Project-MONAI/MONAILabel/pull/731 added torchmaxflow==0.0.6rc1 to the requirements, MONAI Label stopped working for torch versions older than 1.10.0, specifically version 1.8.0.

I’ve also tried installing previous torchmaxflow versions (0.0.4 and 0.0.5) and still got the same error.

To Reproduce

  • Using Linux/Ubuntu OS, create a virtual environment with Python=3.8 or Python=3.9.
  • Once created, install requirements.txt.

Expected behavior

MONAI Label server starts

Screenshots

Screenshot from 2022-04-13 17-47-13

Environment

Ensuring you use the relevant python executable, please paste the output of:

================================
Printing MONAI config...
================================
MONAI version: 0.8.1
Numpy version: 1.22.3
Pytorch version: 1.8.0+cu111
MONAI flags: HAS_EXT = False, USE_COMPILED = False
MONAI rev id: 71ff399a3ea07aef667b23653620a290364095b1

Optional dependencies:
Pytorch Ignite version: 0.4.8
Nibabel version: 3.2.2
scikit-image version: 0.19.2
Pillow version: 9.1.0
Tensorboard version: 2.8.0
gdown version: 4.4.0
TorchVision version: 0.9.0+cu111
tqdm version: 4.64.0
lmdb version: 1.3.0
psutil version: 5.9.0
pandas version: NOT INSTALLED or UNKNOWN VERSION.
einops version: 0.4.1
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.

For details about installing the optional dependencies, please visit:
    https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies


================================
Printing system config...
================================
System: Linux
Linux version: Ubuntu 20.04.4 LTS
Platform: Linux-5.13.0-39-generic-x86_64-with-glibc2.31
Processor: x86_64
Machine: x86_64
Python version: 3.9.12
Process name: python
Command: ['python', '-c', 'import monai; monai.config.print_debug_info()']
Open files: []
Num physical CPUs: 24
Num logical CPUs: 48
Num usable CPUs: 48
CPU usage (%): [12.9, 11.5, 14.5, 14.8, 12.9, 16.4, 11.5, 14.3, 10.0, 14.5, 11.5, 11.3, 11.5, 12.9, 12.9, 12.9, 11.7, 14.3, 11.5, 12.7, 11.5, 11.3, 12.9, 12.9, 11.5, 12.9, 11.3, 11.3, 11.3, 12.9, 11.5, 11.5, 12.7, 11.5, 12.7, 14.5, 12.9, 11.3, 12.9, 12.9, 11.5, 11.5, 11.3, 11.5, 12.9, 11.3, 14.8, 98.4]
CPU freq. (MHz): 2
Load avg. in last 1, 5, 15 mins (%): [1.7, 1.4, 1.4]
Disk usage (%): 84.6
Avg. sensor temp. (Celsius): UNKNOWN for given OS
Total physical memory (GB): 125.7
Available memory (GB): 110.5
Used memory (GB): 13.7

================================
Printing GPU config...
================================
Num GPUs: 2
Has CUDA: True
CUDA version: 11.1
cuDNN enabled: True
cuDNN version: 8005
Current device: 0
Library compiled for CUDA architectures: ['sm_37', 'sm_50', 'sm_60', 'sm_70', 'sm_75', 'sm_80', 'sm_86']
GPU 0 Name: NVIDIA RTX A6000
GPU 0 Is integrated: False
GPU 0 Is multi GPU board: False
GPU 0 Multi processor count: 84
GPU 0 Total memory (GB): 47.5
GPU 0 CUDA capability (maj.min): 8.6
GPU 1 Name: NVIDIA RTX A6000
GPU 1 Is integrated: False
GPU 1 Is multi GPU board: False
GPU 1 Multi processor count: 84
GPU 1 Total memory (GB): 47.5
GPU 1 CUDA capability (maj.min): 8.6

Additional context

I’m using torch version 1.8.0 because it is the only one compatible with my GPU card (?)

Newer torch versions create the following error:

NVIDIA RTX A6000 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA RTX A6000 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

Which I solved by installing the following versions:

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
SachidanandAllecommented, Apr 14, 2022

Soon monai core also dropping support for older torch version… lets fix the readme/requirements… we need scribbles… so lets recommend users to use torch >= 1.10

1reaction
masadcvcommented, Apr 20, 2022

Apologies for delayed response on this.

As mentioned in https://github.com/Project-MONAI/MONAILabel/pull/731#issuecomment-1097323581 and discussed in that thread, an alternate could be to use numpy for maxflow (instead of torch).

I have a variant of maxflow library that interfaces through numpy (https://github.com/masadcv/numpymaxflow) – it still needs a lot of testing and debugging but may be a good alternative for getting rid of torch version tied to torchmaxflow library. I will update and open a PR to switch to this once it is ready.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation — MONAI Label 0.6.0rc5 Documentation
MONAI Label supports both Ubuntu and Windows OS with GPU/CUDA enabled. Make sure you have python 3.7/3.8/3.9 version environment with PyTorch and CUDA...
Read more >
ITK version: NOT INSTALLED or UNKNOWN VERSION #82
Hi @Sebagam ,. I think you are using MONAI 0.3 and run the example in 0.3 tag. Could you please help uninstall and...
Read more >
onnx export of instance_norm for unknown channel size. - ...
Dynamic output of Upsample causes InstanceNorm2d error in onnx. To Reproduce. python import torch ...
Read more >
MONAI Label - Installation with PyPi, Docker, and GitHub
In this video, you'll learn how to install MONAI Label, including PyPi, Docker, and GitHub installation methods. You'll also understand the ...
Read more >
Issues installing PyTorch 1.4 - "No matching distribution ...
If it doesn't help the possible solution might be installing package ... I was trying to install torch 1.10.0 on Python 3.10.6 which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found