Project-MONAI / MONAILabel

MONAI Label is an intelligent open source image labeling and learning tool.
https://docs.monai.io/projects/label
Apache License 2.0
567 stars 185 forks source link

monailabel cannot be installed in python 3.11 #1569

Open AlexanderZeilmann opened 8 months ago

AlexanderZeilmann commented 8 months ago

Describe the bug monailabel cannot be install in python 3.11. See also #1454.

Server logs

$ pip install monailabel
Collecting monailabel
  Obtaining dependency information for monailabel from https://files.pythonhosted.org/packages/c0/47/a580515bf693ed0a0be595c3dc93ec2cca9e74ec2f70fb3d08c39e742219/monailabel-0.7.0-202306100113-py3-none-any.whl.metadata
  Using cached monailabel-0.7.0-202306100113-py3-none-any.whl.metadata (22 kB)
Requirement already satisfied: monai[fire,gdown,ignite,itk,lmdb,mlflow,nibabel,openslide,pillow,psutil,skimage,tensorboard,torchvision,tqdm]>=1.2.0 in ./miniconda3/lib/python3.11/site-packages (from monailabel) (1.2.0)
Collecting uvicorn==0.21.1 (from monailabel)
  Using cached uvicorn-0.21.1-py3-none-any.whl (57 kB)
Collecting pydantic>=1.10.7 (from monailabel)
  Obtaining dependency information for pydantic>=1.10.7 from https://files.pythonhosted.org/packages/1f/1a/71b404f9acb44402f5b581ade106e9219d6d83824d50943e630fc0ca12e5/pydantic-2.0.3-py3-none-any.whl.metadata
  Using cached pydantic-2.0.3-py3-none-any.whl.metadata (128 kB)
Collecting python-dotenv==1.0.0 (from monailabel)
  Using cached python_dotenv-1.0.0-py3-none-any.whl (19 kB)
Collecting fastapi==0.95.0 (from monailabel)
  Using cached fastapi-0.95.0-py3-none-any.whl (57 kB)
Collecting python-multipart==0.0.6 (from monailabel)
  Using cached python_multipart-0.0.6-py3-none-any.whl (45 kB)
Collecting requests-toolbelt==0.10.1 (from monailabel)
  Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)
Collecting httpx==0.23.3 (from monailabel)
  Using cached httpx-0.23.3-py3-none-any.whl (71 kB)
Collecting schedule==1.1.0 (from monailabel)
  Using cached schedule-1.1.0-py2.py3-none-any.whl (10 kB)
Collecting dicomweb-client==0.59.1 (from monailabel)
  Using cached dicomweb_client-0.59.1-py3-none-any.whl (60 kB)
Collecting timeloop==1.0.2 (from monailabel)
  Using cached timeloop-1.0.2.tar.gz (2.9 kB)
  Preparing metadata (setup.py) ... done
Collecting expiringdict==1.2.2 (from monailabel)
  Using cached expiringdict-1.2.2-py3-none-any.whl (8.5 kB)
Collecting expiring-dict==1.1.0 (from monailabel)
  Using cached expiring_dict-1.1.0-py3-none-any.whl (3.6 kB)
Collecting cachetools==5.3.0 (from monailabel)
  Using cached cachetools-5.3.0-py3-none-any.whl (9.3 kB)
Collecting watchdog==3.0.0 (from monailabel)
  Using cached watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
Collecting pydicom==2.3.1 (from monailabel)
  Using cached pydicom-2.3.1-py3-none-any.whl (2.0 MB)
Collecting pydicom-seg==0.4.1 (from monailabel)
  Using cached pydicom_seg-0.4.1-py3-none-any.whl (27 kB)
Collecting pynetdicom==2.0.2 (from monailabel)
  Using cached pynetdicom-2.0.2-py3-none-any.whl (1.6 MB)
Collecting pynrrd==1.0.0 (from monailabel)
  Using cached pynrrd-1.0.0-py2.py3-none-any.whl (19 kB)
Collecting opencv-python-headless==4.7.0.72 (from monailabel)
  Using cached opencv_python_headless-4.7.0.72-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (49.2 MB)
Collecting numpymaxflow==0.0.5 (from monailabel)
  Using cached numpymaxflow-0.0.5.tar.gz (14 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Collecting setuptools
        Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/c7/42/be1c7bbdd83e1bfb160c94b9cafd8e25efc7400346cf7ccdbdb452c467fa/setuptools-68.0.0-py3-none-any.whl.metadata
        Using cached setuptools-68.0.0-py3-none-any.whl.metadata (6.4 kB)
      ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
      ERROR: Could not find a version that satisfies the requirement numpy==1.21.6 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0rc1, 1.24.0rc2, 1.24.0, 1.24.1, 1.24.2, 1.24.3, 1.24.4, 1.25.0rc1, 1.25.0, 1.25.1)
      ERROR: No matching distribution found for numpy==1.21.6
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

To Reproduce Steps to reproduce the behavior:

  1. Install python 3.11
  2. pip install monailabel

Expected behavior monailabel should work with python 3.11

Other solutions Downgrading to python 3.10 works in some environments, but often the python version cannot be influenced and this is only a temporary solution.

jamesobutler commented 6 months ago

This issue with Python 3.11 also came up on the 3D Slicer forum. See https://discourse.slicer.org/t/openslide-python-not-working-when-trying-to-use-monailabel/33427.

The monai backend requires a specific openslide-python that does not have any Python 3.11 whl files on PyPI and the user fails to have all the dependencies to build it successfully from source.

diazandr3s commented 6 months ago

Hi @AlexanderZeilmann,

Thanks for opening this issue.

As @jamesobutler, commented, MONAI Label hasn't been tested on Python 3.11 yet.

It is tested on Python 3.10 as you can see here: https://github.com/Project-MONAI/MONAI/blob/865972f7a791bf7b42efbcd87c8402bd865b329e/setup.cfg#L26

I'd recommend working with a Python env on version 3.9 or 3.10 or working with the MONAI Label Docker container: https://hub.docker.com/layers/projectmonai/monailabel/latest/images/sha256-e91d3a715c0381545bd88605b6ef61e73df30fe32f3fcc2c38e4c6e9a5a0f810?context=explore#!

More information about the Docker container is here: https://github.com/Project-MONAI/MONAILabel#development-version

Hope this helps,

jamesobutler commented 6 months ago

I have written up https://github.com/Project-MONAI/MONAI/issues/7335 to encourage a newer version of python-openslide so that Python 3.11 can be used without running into issues of certain dependencies failing to build/install.