python / python/cpython

`freeze.py` doesn't work on Windows

Open
#132,225 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-windows type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

I tried to run freeze.py under the README instructions here.

# Assumed I was in the Python source tree root
python .\Tools\freeze\freeze.py -p . -o hello  .\PCbuild\amd64\tests\hello.py

It did generate lots of .c source files. But when I ran nmake to generate the target, it complained as follows

Microsoft (R) Program Maintenance Utility Version 14.43.34809.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        if not exist Build\Release\. mkdir Build\Release
NMAKE : fatal error U1073: don't know how to make '".\Python\frozenmain.c"'
Stop.

It looks like it could not find the correct Python path. Then I tried ran the command without the output directory option

python .\Tools\freeze\freeze.py -p .  .\PCbuild\amd64\tests\hello.py

And ran nmake. It complained as follows

Microsoft (R) Program Maintenance Utility Version 14.43.34809.0
Copyright (C) Microsoft Corporation.  All rights reserved.

frozenmain.c
./Include\Python.h(14): fatal error C1083: Cannot open include file: 'pyconfig.h': No such file or directory
NMAKE : fatal error U1077: 'cl -c -nologo /FoBuild\Release\frozenmain /MD /Ox /D BUILD_FREEZE "-I./Include"  "-I./PC"      ".\Python\frozenmain.c"' : return code '0x2'
Stop.

I found the PC\pyconfig.h was removed since Python3.13. Should we update the document?

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Tools/freeze/README and Tools/freeze/freeze.py, then reproduce the Windows commands from the report with nmake. Check how the output directory and Windows include paths are handled, including the missing PC/pyconfig.h noted in the report. Done means the Windows freeze instructions or implementation produce a build without the reported path and header errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, documentation, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.