# Bulild 3D Slicer - step: python failed

**URL:** <https://discourse.slicer.org/t/bulild-3d-slicer-step-python-failed/17224>\
**Category:** Support\
**Tags:** build, python\
**Created:** [April 21, 2021, 2:50pm UTC](https://discourse.slicer.org/t/bulild-3d-slicer-step-python-failed/17224 "2021-04-21T14:50:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wlixism](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wlixism](https://discourse.slicer.org/u/wlixism)\
**Post date:** [April 21, 2021, 2:50pm UTC](https://discourse.slicer.org/t/bulild-3d-slicer-step-python-failed/17224/1 "2021-04-21T14:50:56Z")

</div>

Dear all,  
I was asked to create a 3D slicer module at work.  
I ran cmake according to the build instructions, but I got some errors in python step.  
I guess the cause was that my env PYTHONHOME was used.  
In that case, should I delete the environment variable PYTHONHOME and re-build it?  
Or do I need to modify some cmake files for python step?

I’m sorry for the childish question and not good at English.

Operating system: Windows10 64bit Home  
Slicer version: Nightly

cmake log:  
Performing install step for ‘python’  
Microsoft (R) Build Engine for .NET Framework version 16.9.0+5e4b48a27  
…  
Creating ‘bin/Release/Modules/Setup.local’  
python.vcxproj → C:\cw\3dslicer\release\python-build\bin\Release\python.exe  
Copying ‘pyconfig.h’ to ‘bin/Release/PC’  
– Install configuration: “Release”  
…  
– Installing: C:/cw/3dslicer/release/python-install/Lib/zipfile.py  
EXEC : Fatal Python error : Py\_Initialize: can’t initialize sys standard streams [C:\cw\3dslicer\release\python-build\i  
nstall.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
Traceback (most recent call last):  
File “C:\lib\anaconda3\Lib\abc.py”, line 64, in   
ModuleNotFoundError: No module named ‘\_abc’

```
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\lib\anaconda3\Lib\io.py", line 52, in <module>
  File "C:\lib\anaconda3\Lib\abc.py", line 68, in <module>
  File "C:\lib\anaconda3\Lib\_py_abc.py", line 35
    def __new__ (mcls, name, bases, namespace, /, **kwargs):
                                              ^
SyntaxError: invalid syntax

```

EXEC : Fatal Python error : Py\_Initialize: can’t initialize sys standard streams [C:\cw\3dslicer\release\python-build\i  
nstall.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
Traceback (most recent call last):  
File “C:\lib\anaconda3\Lib\abc.py”, line 64, in   
ModuleNotFoundError: No module named ‘\_abc’

```
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\lib\anaconda3\Lib\io.py", line 52, in <module>
  File "C:\lib\anaconda3\Lib\abc.py", line 68, in <module>
  File "C:\lib\anaconda3\Lib\_py_abc.py", line 35
    def __new__ (mcls, name, bases, namespace, /, **kwargs):

```

[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: Command “setlocal [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: C:\scoop\apps\cmake\3.20.1\bin\cmake.exe -DBUILD\_TYPE=Release -P cmake\_install.cmake [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmEnd [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmErrorLevel [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: exit /b %1 [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :cmDone [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(155,5): error MSB3073: :VCEnd” finished with code -1. [C:\cw\3dslicer\release\python-build\install.vcxproj] [C:\cw\3dslicer\release\python.vcxproj]  
[MSVC path]\v160\Microsoft.CppCommon.targets(240,5): error MSB8066: ‘C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-mkdir.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-download.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee  
47de97ec6ff776c317e3f0\python-update.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-patch.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-configure.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-build.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff7  
76c317e3f0\python-install.rule;C:\cw\3dslicer\release\CMakeFiles\40ca38eeee47de97ec6ff776c317e3f0\python-configure\_python\_launcher.rule;C:\cw\3dslicer\release\CMakeFiles\79fe27a2f529f2d6c83674a26c4a115b\python-complete.rule;C:\cw\3dslicer\release\CMakeFiles\37bc3efd16376f2989467fd22aa298bd\python.rule’ of custom build is finished at exit code 1. [C:\cw\3dslicer\release\pyth  
on.vcxproj]

Best Regards,  
Tsubasa Tanaka
