AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.11k stars 485 forks source link

[BUG] Unable to install pyradiomics with Python 3.10 #859

Open marek-lechowicz opened 7 months ago

marek-lechowicz commented 7 months ago

Hi, I have a followitg problem with pyradiomics installation.

when I specify the version I get such output: Requested pyradiomics==3.1.0 from https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1' ERROR: Could not find a version that satisfies the requirement pyradiomics==3.1.0 (from versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 3.0, 3.0.1a3, 3.0.1, 3.1.0) ERROR: No matching distribution found for pyradiomics==3.1.0

If I run general command it switches to install other version but fails in a weird way (I have numpy installed)

pip install pyradiomics
Collecting pyradiomics
  Using cached pyradiomics-3.1.0.tar.gz (34.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (from https://pypi.org/simple/pyradiomics/): Requested pyradiomics from https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1'
  Using cached pyradiomics-3.0.1.tar.gz (34.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "D:\studia_zadania\Others\AIImageDetection\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\studia_zadania\Others\AIImageDetection\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "D:\studia_zadania\Others\AIImageDetection\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\mlech\AppData\Local\Temp\pip-build-env-zvyo7zaq\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\mlech\AppData\Local\Temp\pip-build-env-zvyo7zaq\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\mlech\AppData\Local\Temp\pip-build-env-zvyo7zaq\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 7, in <module>
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

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

× Getting requirements to build wheel 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.

Version (please complete the following information):

Additional context Using python virtual environment

marek-lechowicz commented 6 months ago

Running pip install pyradiomics inside Windows Terminal with Admin priviliges helped

jim-bo commented 6 months ago

I too have this problem. On OsX same error.

jim-bo commented 6 months ago

For what it's worth, I was able to gitclone the repo, build the dependencies and install it manually (including compilation). I think there might be something wrong with the wheels/conda packages that are built. I'm no expert though so I don't have a recommendation... just an FYI

strixy16 commented 5 months ago

I'm having this problem as well on macOS. Trying to install in a conda environment after pip installing numpy, I try to install pyradiomics 3.1.0 and get this output

pip install pyradiomics
Collecting pyradiomics
  Using cached pyradiomics-3.1.0.tar.gz (34.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Discarding https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (from https://pypi.org/simple/pyradiomics/): Requested pyradiomics from https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1'
  Using cached pyradiomics-3.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Requirement already satisfied: numpy>=1.9.2 in /Users/katyscott/opt/miniconda3/envs/temp/lib/python3.9/site-packages (from pyradiomics) (1.26.3)
Collecting SimpleITK>=0.9.1 (from pyradiomics)
  Using cached SimpleITK-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl.metadata (7.9 kB)
Collecting PyWavelets>=0.4.0 (from pyradiomics)
  Using cached pywavelets-1.5.0-cp39-cp39-macosx_10_13_x86_64.whl.metadata (9.0 kB)
Collecting pykwalify>=1.6.0 (from pyradiomics)
  Using cached pykwalify-1.8.0-py2.py3-none-any.whl (24 kB)
Collecting six>=1.10.0 (from pyradiomics)
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting docopt>=0.6.2 (from pykwalify>=1.6.0->pyradiomics)
  Using cached docopt-0.6.2-py2.py3-none-any.whl
Collecting python-dateutil>=2.8.0 (from pykwalify>=1.6.0->pyradiomics)
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting ruamel.yaml>=0.16.0 (from pykwalify>=1.6.0->pyradiomics)
  Using cached ruamel.yaml-0.18.5-py3-none-any.whl.metadata (23 kB)
Collecting ruamel.yaml.clib>=0.2.7 (from ruamel.yaml>=0.16.0->pykwalify>=1.6.0->pyradiomics)
  Using cached ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl.metadata (2.2 kB)
Using cached pywavelets-1.5.0-cp39-cp39-macosx_10_13_x86_64.whl (4.4 MB)
Using cached SimpleITK-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl (44.9 MB)
Using cached ruamel.yaml-0.18.5-py3-none-any.whl (116 kB)
Using cached ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl (148 kB)
Installing collected packages: SimpleITK, docopt, six, ruamel.yaml.clib, PyWavelets, ruamel.yaml, python-dateutil, pykwalify, pyradiomics
Successfully installed PyWavelets-1.5.0 SimpleITK-2.3.1 docopt-0.6.2 pykwalify-1.8.0 pyradiomics-3.0.1 python-dateutil-2.8.2 ruamel.yaml-0.18.5 ruamel.yaml.clib-0.2.8 six-1.16.0

So it manages to install pyradiomics 3.0.1, but not the latest version. This happens with both Python 3.10.13 and 3.9.0

dsantiago commented 4 months ago

Like @strixy16 said, the error that it doesn't install the 3.1.0 appear to be in meta data. I am getting this error also...

...
Discarding https://files.pythonhosted.org/packages/03/c1/20fc2c50ab1e3304da36d866042
a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz (from https://pypi.org/simple/pyradiomics/): 

Requested pyradiomics from https://files.pythonhosted.org/packages/03/c1/
20fc2c50ab1e3304da36d866042a1905a2b05a1431ece35448ab6b4578f2/pyradiomics-3.1.0.tar.gz 
has inconsistent version: expected '3.1.0', but metadata has '3.0.1a1'
kirbyju commented 2 months ago

I just learned that if you setup an environment with Python 3.9 it will work, but there are no wheels for later versions yet.

kirbyju commented 1 month ago

Update: I finally got around to trying with Python 3.9 in a fresh virtual environment and it still didn't work. However, I did have success installing it inside of 3D Slicer's Python environment (which apparently runs 3.9 so I'm not sure why it worked there but not in my other testing).

mluerig commented 1 month ago

it did install fine for me under python 3.10, but I had to remove the version in my pipeline (was "pyradiomics==3.1.0"). @JoostJM would you mind looking into this? I think it's just a matter of updating the meta-data...