# Build error on MacOSX, When install simpleITK, ModuleNotFoundError: No module named 'skbuild' occur

**URL:** <https://discourse.slicer.org/t/build-error-on-macosx-when-install-simpleitk-modulenotfounderror-no-module-named-skbuild-occur/19734>\
**Category:** Development\
**Tags:** build\
**Created:** [September 18, 2021, 12:10am UTC](https://discourse.slicer.org/t/build-error-on-macosx-when-install-simpleitk-modulenotfounderror-no-module-named-skbuild-occur/19734 "2021-09-18T00:10:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RuoyanMeng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ruoyanmeng/32/12403_2.png) [@RuoyanMeng](https://discourse.slicer.org/u/RuoyanMeng)\
**Post date:** [September 18, 2021, 12:10am UTC](https://discourse.slicer.org/t/build-error-on-macosx-when-install-simpleitk-modulenotfounderror-no-module-named-skbuild-occur/19734/1 "2021-09-18T00:10:29Z")

</div>

MacOS 11.5.2,  
Qt 5.15.2,  
Xcode 12.5.1,  
cmake 3.20.5

SimpleITK: install step failed with exit code ‘1’.

```auto
Best match: SimpleITK 2.1.0
Processing SimpleITK-2.1.0.tar.gz
Writing /tmp/easy_install-e5igwpuy/SimpleITK-2.1.0/setup.cfg
Running SimpleITK-2.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-e5igwpuy/SimpleITK-2.1.0/egg-dist-tmp-uwx0nksb

zip_safe flag not set; analyzing archive contents...
SimpleITK. __pycache__._SimpleITK.cpython-36: module references __file__
Traceback (most recent call last):
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 152, in save_modules
    yield saved
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 254, in run_setup
    _execfile(setup_script, ns)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-e5igwpuy/SimpleITK-2.1.0/setup.py", line 3, in <module>
    
ModuleNotFoundError: No module named 'skbuild'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 85, in <module>
    cmdclass={'build_ext':build_ext}
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/ __init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/opt/s/python-install/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/opt/s/python-install/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/opt/s/python-install/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run(show_deprecation=False)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 408, in run
    self.easy_install(spec, not self.no_deps)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 650, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 697, in install_item
    self.process_distribution(spec, dist, deps)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 745, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/opt/s/python-install/lib/python3.6/site-packages/pkg_resources/ __init__.py", line 768, in resolve
    replace_conflicting=replace_conflicting
  File "/opt/s/python-install/lib/python3.6/site-packages/pkg_resources/ __init__.py", line 1051, in best_match
    return self.obtain(req, installer)
  File "/opt/s/python-install/lib/python3.6/site-packages/pkg_resources/ __init__.py", line 1063, in obtain
    return installer(requirement)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 669, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 695, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1162, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1146, in run_setup
    run_setup(setup_script, args)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 257, in run_setup
    raise
  File "/opt/s/python-install/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/opt/s/python-install/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 164, in save_modules
    saved_exc.resume()
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 139, in resume
    raise exc.with_traceback(self._tb)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 152, in save_modules
    yield saved
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 193, in setup_context
    yield
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 254, in run_setup
    _execfile(setup_script, ns)
  File "/opt/s/python-install/lib/python3.6/site-packages/setuptools/sandbox.py", line 43, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-e5igwpuy/SimpleITK-2.1.0/setup.py", line 3, in <module>
    
ModuleNotFoundError: No module named 'skbuild'
CMake Error at 
  ../Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:104 (message):
  SimpleITK: install step failed with exit code '1'.

  Outputs also captured in /opt/s/SimpleITK_install_step_output.txt and
  /opt/s/SimpleITK_install_step_error.txt.

  Setting env. variable EP_EXECUTE_DISABLE_CAPTURE_OUTPUTS to 1 allows to
  disable file capture.

Call Stack (most recent call first):
  /opt/s/SimpleITK_install_step.cmake:3 (ExternalProject_Execute)

```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 18, 2021, 12:28am UTC](https://discourse.slicer.org/t/build-error-on-macosx-when-install-simpleitk-modulenotfounderror-no-module-named-skbuild-occur/19734/2 "2021-09-18T00:28:25Z")

</div>

It seems that you have run into this issue (SimeITK finds system Python instead of Slicer’s):

> <https://github.com/Slicer/Slicer/issues/5498>
>
> When building latest master version on Windows, using Visual Studio, in debug mo…de, then build fails with this error:
> 
> \`\`\`
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
> Could NOT find Python3 (missing: Python3\_EXECUTABLE Interpreter) (found
> suitable version "3.7", minimum required is "3.6")
> Call Stack (most recent call first):
> C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (\_FPHSA\_FAILURE\_MESSAGE)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/patches/3.18/FindPython/Support.cmake:2578 (find\_package\_handle\_standard\_args)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/patches/3.18/FindPython3.cmake:348 (include)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/VTK-vtk-module-find-packages.cmake:303 (find\_package)
> C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/vtk-config.cmake:138 (include)
> C:/D/S4D/VTK-build/vtk-config.cmake:1 (include)
> C:/D/S4D/ITK-build/lib/cmake/ITK-5.1/Modules/ITKVtkGlue.cmake:30 (find\_package)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:76 (include)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:31 (itk\_module\_load)
> C:/D/S4D/ITK/CMake/ITKModuleAPI.cmake:129 (\_itk\_module\_config\_recurse)
> C:/D/S4D/ITK-build/ITKConfig.cmake:77 (itk\_module\_config)
> SuperBuild.cmake:386 (find\_package)
> CMakeLists.txt:38 (include)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also "C:/D/S4D/SimpleITK-build/CMakeFiles/CMakeOutput.log".
> See also "C:/D/S4D/SimpleITK-build/CMakeFiles/CMakeError.log".
> C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Microsoft\\VC\\v160\\Microsoft.CppCommon.targets(238
> ,5): error MSB8066: Custom build for 'C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-mkdir.rule;C:\\D\\S4
> D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-download.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde629
> 1e1\\SimpleITK-update.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-patch.rule;C:\\D\\S4D\\CMakeFiles
> \\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-configure.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleI
> TK-build.rule;C:\\D\\S4D\\CMakeFiles\\76a3bb6e84cfb300f8ba64bbde6291e1\\SimpleITK-install.rule;C:\\D\\S4D\\CMakeFiles\\55773c0e5
> 810be009a8f38bd18c05739\\SimpleITK-complete.rule;C:\\D\\S4D\\CMakeFiles\\f5993a3ec64cf58c5707908b20f354e5\\SimpleITK.rule;C:\\
> D\\S4\\CMakeLists.txt' exited with code 1. \[C:\\D\\S4D\\SimpleITK.vcxproj\]
> \`\`\`
> 
> I don't know if it is related, but SimpleITK CMake cache (c:\\D\\S4D\\SimpleITK-build\\CMakeCache.txt) picks up pieces of anaconda, which is strange because my environment variables are clean (there is absolutely no mention of anaconda or python in any of the variables):
> 
> \`\`\`
> //Path to a program.
> \_Python3\_CONFIG:INTERNAL=\_Python3\_CONFIG-NOTFOUND
> \_Python3\_DEVELOPMENT\_EMBED\_SIGNATURE:INTERNAL=0993e8f7af6d2f88f03f3f71fd289925
> \_Python3\_DEVELOPMENT\_MODULE\_SIGNATURE:INTERNAL=0993e8f7af6d2f88f03f3f71fd289925
> //Path to a program.
> \_Python3\_EXECUTABLE:INTERNAL=\_Python3\_EXECUTABLE-NOTFOUND
> //Path to a file.
> \_Python3\_INCLUDE\_DIR:INTERNAL=C:/Users/andra/anaconda3/include
> //Path to a library.
> \_Python3\_LIBRARY\_DEBUG:INTERNAL=\_Python3\_LIBRARY\_DEBUG-NOTFOUND
> //Path to a library.
> \_Python3\_LIBRARY\_RELEASE:INTERNAL=C:/Users/andra/anaconda3/libs/python37.lib
> //Path to a library.
> \_Python3\_RUNTIME\_LIBRARY\_RELEASE:INTERNAL=C:/Users/andra/anaconda3/python37.dll
> //Result of TRY\_COMPILE
> project\_compiles:INTERNAL=FALSE
> \`\`\`
> 
> You can find the full logs here: https://1drv.ms/u/s!Arm\_AFxB9yqHxaN2aILYudYPjN5xdA?e=Fhpgcf

Please check in the issue tracker if there is an easy workaround.

---

<div class="post-metadata">

**Author:** ![RuoyanMeng](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ruoyanmeng/32/12403_2.png) [@RuoyanMeng](https://discourse.slicer.org/u/RuoyanMeng)\
**Post date:** [September 19, 2021, 12:12pm UTC](https://discourse.slicer.org/t/build-error-on-macosx-when-install-simpleitk-modulenotfounderror-no-module-named-skbuild-occur/19734/3 "2021-09-19T12:12:18Z")

</div>

Hi, thank you for the information. I can see that I met the same problem that SimpleITK just find the wrong python path( which is my system path).
