(PCbuild\build.bat -c Debug ) raising errors

I am new to open-source and was following the dev guide Setup and Building
After cloning, PCbuild\build.bat -c Debug is raising an error
Here goes:-

Fetching tcltk-
Traceback (most recent call last):
  File "C:\Users\Ishan\cpython\PCbuild\get_external.py", line 77, in <module>
  File "C:\Users\Ishan\cpython\PCbuild\get_external.py", line 50, in main
    zip_path = fetch_zip(
  File "C:\Users\Ishan\cpython\PCbuild\get_external.py", line 19, in fetch_zip
    filename, headers = urlretrieve(
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 517, in open
    response = self._open(req, data)
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 539, in _open
    return self._call_chain(self.handle_open, 'unknown',
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\Users\Ishan\anaconda3\lib\urllib\request.py", line 1417, in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
Cannot locate MSBuild.exe on PATH or as MSBUILD variable

This is what is wrong. You have not setup your PATH to allow access to Microsoft Visual Studio tools. Specifically msbuild.exe.

I use CMD script to setup the PATH for me like this that knows about the various places that visual studio is installed and call the vcvars64.bat to setup the environment, which include setting PATH:

set VC_VER=14.0

rem if Win64 then setup path to include the 64bit CL.exe
rem when called in place this can fork bomb (lots of CMD.exe in task manager)
if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
    call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

) else if exist "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
    call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

) else if exist "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" (
    call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"

) else if exist "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat" (
    call "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat"

) else (
    echo Error: Cannot find C++ compiler tools
1 Like

Or use the Developer Command Prompt / PowerShell, which sets up everything but the kitchen sink. I configure profiles in Windows Terminal that run one of the following command lines. Modify the target architecture and host architecture as desired/supported (amd64, x86, arm, arm64).


"%ComSpec%" /k "%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64


"%ProgramFiles%\PowerShell\7\pwsh.exe" -NoLogo -NoExit -File "%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation