InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

Failed building wheel for itk (is likely not a problem with pip) #4590

Closed GingerSpacetail closed 2 months ago

GingerSpacetail commented 2 months ago

Description

Installation failure

I was going to reinstall my itk which happens to have an empty _init.py__ file (no attributes e.g. itk.image)

AttributeError: module 'itk' has no attribute 'image'

but failed to install it at all

Steps to Reproduce

Step 1. Create a fresh new env to install itk

conda create -n itkenv
conda activate itkenv

Step 2. Try to installing from conda or pip

(itkenv) conda install -c conda-forge itk
(itkenv) pip install itk

Expected behavior

Downloading and Extracting Packages:
...
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Actual behavior

for conda install:

Channels:
 - conda-forge
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - itk
Current channels:
  - https://conda.anaconda.org/conda-forge
  - defaults

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

for pip:

Collecting itk
  Using cached itk-5.0.1.tar.gz (13 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: itk
  Building wheel for itk (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "/Users/user/miniforge3/envs/itkenv/lib/python3.12/site-packages/skbuild/setuptools_wrap.py", line 645, in setup
          cmkr = cmaker.CMaker(cmake_executable)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/miniforge3/envs/itkenv/lib/python3.12/site-packages/skbuild/cmaker.py", line 148, in __init__
          self.cmake_version = get_cmake_version(self.cmake_executable)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/miniforge3/envs/itkenv/lib/python3.12/site-packages/skbuild/cmaker.py", line 105, in get_cmake_version
          raise SKBuildError(msg) from err

      Problem with the CMake installation, aborting build. CMake executable is cmake
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for itk
  Running setup.py clean for itk
Failed to build itk
ERROR: Could not build wheels for itk, which is required to install pyproject.toml-based projects

Reproducibility

try again with

conda create -n myenv python
conda activate myenv
(myenv) pip install itk
Collecting itk
  Using cached itk-5.0.1.tar.gz (13 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      scikit-build is required to build from source.
      Please run:

        python -m pip install scikit-build
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

after installation of scikit-build

python -m pip install scikit-build

appears the same error

Versions

5.0.1 5.0.0 4.13.1.post1

Environment

osx-arm64 python 3.12 miniforge3

Additional Information

github-actions[bot] commented 2 months ago

Thank you for contributing an issue! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜 Also, please check existing open issues and consider discussion on the ITK Discourse. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.

dzenanz commented 2 months ago

There are no wheels yet for Python 3.12 for a stable version of ITK. Try --pre flag for pip. That should use Python3 ABI wheels.

dzenanz commented 2 months ago

This is likely a duplicate of #4449 and #4451.

GingerSpacetail commented 2 months ago

Thank you! Sorry for not noticing the other related issues.

dzenanz commented 2 months ago

Close this issue if appropriate, or provide more information.

GingerSpacetail commented 2 months ago

downgrading to python 3.11 did the trick, the same as mentioned in 4451 Thank you!

P.S. Now there is an empty init.py file, but I look for a similar issue before opening a new issue. Thank again!