ITKConfig.cmake problems

Hi all, I’m an absolute beginner :smiling_face_with_tear:, trying to install “antspyx”, that require ITK.
I’ve build ITK with CMake in Windows 11, now I’ve just one folder that i named “ITKbinaries” in C:/Users/giorg/binariesITK.
My first question is: how I get two folders “ITK_source” and “ITK_build”? Browsing the discussions seems that it is the normal behavior.

Second question, that’s the console error when I try to install antspyx both in my pc or in a virtual environment
`
(ants2) C:\ANTsPy\src>cd ....
CMake Error at CMakeLists.txt:36 (find_package):
By not providing “FindITK.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “ITK”, but
CMake did not find one.

    Could not find a package configuration file provided by "ITK" with any of
    the following names:

      ITKConfig.cmake
      itk-config.cmake

    Add the installation prefix of "ITK" to CMAKE_PREFIX_PATH or set "ITK_DIR"
    to a directory containing one of the above files.  If "ITK" provides a
    separate development package or SDK, be sure it has been installed.


  -- Configuring incomplete, errors occurred!

  *** CMake configuration failed
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for antspyx
Failed to build antspyx
ERROR: Failed to build installable wheels for some pyproject.toml based projects (antspyx)

How can I solve it? Must I just rename the folder containing ITKConfig.cmake as ITK_DIR? Install anstspy in the same directory of ITK_DIR? (I tried both options and it doesn’t work). Or i’ve to modify theCmakelist.txt line 36 that says find_package (ITK REQUIRED)?

Thanks in advice

It sounds like pip is trying to build from source. It normally downloads ITK C++ libraries and compiles them from source. You need Windows developer tools to do this.

You can look at the past issues with Windows over at

If you need help please open a new issue with details of your hardware, OS, and Python version.

1 Like

I tried doing it with Windows developer tools (using Visual Studio Developer Command Prompt
is right?).
I build ITK via CMake and set Path both as an environment variable and during configuration of ITK_DIR in the CMake GUI. Then I build from source antspyx
git clone https://github.com/antsx/antspy cd antspy python -m pip install .
but the problem persist, I could try again and see if something is missing out.

  • python: 3.9
  • ITK: 5.4.3
  • OS: Windows 11 Home
  • Dell XPS 15 9530

I haven’t built from source on Windows, and I’m not very familiar with Visual Studio, sorry. I know that these tools

are needed for running Windows wheels from pypi. But they may be not needed if you have the full Visual Studio.

When you build from source with pip, it should have its own build environment and compile its own ITK, followed by the ANTs C++ components of antspyx. But it seems that is failing for some reason.

pip does try to build in an isolated environment, so it may need some help on certain systems (eg, by explicitly setting the CC / CXX variables). First thing to try would be to enable verbose output

python -m pip install . -v 2>&1 | tee install_log.txt

If you open an issue on the ANTsPy page, other ANTsPy users may have ideas.

1 Like