Windows Build PythonApplyPatches

Hello everyone,

I want to build Slicer Nightly in Windows 10 environment(VS 2013). I follow instruction from Documentation/Nightly/Developers/Build Instructions - Slicer Wiki and I can’t build all python packages: cmake throw only information about error in PythonApplyPatches.cmake and nothing else.
I succesfully built qt(4.8.7) and made all steps from build instructions site. Before this I had problem with patches executables but then I selected path to git binaries and now I stuck on patches. Additionaly, this is fresh Windows 10 install.


Please post the error messages.

(please use triple-backtick before and after so it is more readable: ```; or post on and link)

If you install git at the default install location then the build system should be able to find patch.exe. If not, then you can try to specify this CMake variable manually when you configure Slicer:


Thank you for respond.
Yes, it was problem with patch.exe and git.exe (should be git.exe from cmd folder).
I reinstalled git and added it in installation step to PATH. Then CMAKE read all settings automatically.

Now I’m fighting with CTK:

IOError: [Errno 2] No such file or directory: ‘E:/software/Slicer-SuperBuild-Release/CTK/Lbs/Widgets/ctkFileDialogEventTranslator.h’

And why there is Lbs not Libs?

Windows deletes every 8192th character from your command line, which causes the error that you see.

The solution is to build Slicer in a shorter directory as it makes command-line argument lists shorter.

I typically use C:\S4 for storing source files and build in C:\S4R or S4D. 1-2 characters longer should work, too. Anything much longer may fail to build (if you are lucky the 8192th character corrupts a non-essential value and then the build may succeed, but it is better not to bet on that).

Ehh. Now I need to recompile all…
Do you use \MP option for faster compiling? All day compiling behind me. And now again.

I don’t use MP option, I’ve tried at some point but the improvement on my computers were not noticeable (takes a couple of hours).

Build successfully. In summary:

  • correctly install git and set PATHS or remember about binaries in cmd folder
  • on the beggining build path as short as possible.

But I have another problem. I can’t import scipy(Successfully installed scipy-1.0.0):

Traceback (most recent call last):
File “”, line 1, in
File “E:\Program Files\Slicer 4.9.0-2018-03-21\lib\Python\Lib\site-packages\”, line 118, in
from scipy._lib._ccallback import LowLevelCallable
File “E:\Program Files\Slicer 4.9.0-2018-03-21\lib\Python\Lib\site-packages\”, line 1, in
from . import _ccallback_c
ImportError: DLL load failed: Procedura inicjowania biblioteki do³¹czanej dynamicznie (DLL) nie powiod³a siê.


I tried install intel mkl and made some research about numpy+mkl, but without success. On linux works like a charm.

Assuming you used pip to install: the most likely problem is that Scipy is linked against a different and incompatible CRT (C Runtime – msvcrt). The upstream Scipy for Python 2.7 is built with Visual Studio 2008. We are planning to switch to Python 3 in the future, which will allow to use packages built with Visual Studio 2015, which should be ABI compatible.

(also, Microsoft has updated the CRT model to eliminate – supposedly – the CRT compatibility issues starting with VS2015)

I understand that now I can’t do anything with that problem and should work without scipy?

You can use Slicer with conda and install any conda packages. I’ve done this in the past successfully. The only catch is that you need to build Slicer on your computer and instead of letting Slicer build its own Python, configure in CMake to use conda instead. See more information here:

On Linux, you can definitively install itk, scipy, tensorflow, etc … within the Slicer environment. But if you can’t switch environment, options are currently limited.

Thank you all for answers. I am going try with conda.
I have got linux environment and I have been working 3 years with Slicer.