Skip to content

Conversation

@tiran
Copy link
Collaborator

@tiran tiran commented May 3, 2025

By default, pip install also compiles byte code of all Python files. The step takes a while, especially for large packages like PyTorch. Disable byte code compilation to speed up installation of build dependencies. Byte code is now compiled on demand.

By default, `pip install` also compiles byte code of all Python files.
The step takes a while, especially for large packages like PyTorch.
Disable byte code compilation to speed up installation of build
dependencies. Byte code is now compiled on demand.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@dhellmann
Copy link
Member

I wouldn't expect pip to be recompiling to bytecode when we install from wheels, and we should always be able to install from wheels. How much difference are you seeing in the times?

@tiran
Copy link
Collaborator Author

tiran commented May 3, 2025

Wheels don't contain pyc files. pip install compiles all Python files to byte code after installation.

python3.11 -m compileall takes about 10 to 12 seconds for a large virtual env with Torch. Smaller virtual envs take 2 to 4 seconds. I expect that we are going to safe a second to a few seconds for each build env. It's not much, but it adds up.

@mergify mergify bot merged commit e9a8c70 into python-wheel-build:main May 3, 2025
95 checks passed
@tiran tiran deleted the no-bytecode-compile branch October 6, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants