`distutils.ccompiler.spawn` is no longer available
When building pygame with the latest setuptools/distutils, this line:
https://github.com/pygame/pygame/blob/79807da84c9bacf8df5a177763e14c924e3b15e2/setup.py#L126
fails with:
AttributeError: module 'distutils.ccompiler' has no attribute 'spawn'
Workaround: sed -i "s/distutils.ccompiler.spawn/distutils.spawn.spawn/" setup.py
sed -i "s/distutils.ccompiler.spawn/distutils.spawn.spawn/" setup.p
Hello! I'm new to coding and have run into an issue. How do I apply this workaround? The code I have is from online, so I don't have prior experience with Pygame.
Workaround:
sed -i "s/distutils.ccompiler.spawn/distutils.spawn.spawn/" setup.py
how to do that if adding it via uv? or I guess: which distutils to install in the uv venv?
Workaround:
sed -i "s/distutils.ccompiler.spawn/distutils.spawn.spawn/" setup.pyhow to do that if adding it via uv? or I guess: which distutils to install in the uv venv?
You cannot do it during the installation, if that's what you are asking about. You can clone/download the code, fix it, and then install it from the updated source.
Thanks for the sed command. Using uv:
git clone --depth=1 https://github.com/pygame/pygame
cd pygame
uv venv
source .venv/bin/activate
uv pip install setuptools
sed -i "s/distutils.ccompiler.spawn/distutils.spawn.spawn/" setup.py
PYGAME_DETECT_AVX2=1 python3 setup.py -config -auto
PYGAME_DETECT_AVX2=1 python3 setup.py build
PYGAME_DETECT_AVX2=1 python3 setup.py install --user
uv pip install .
python3 -m pygame.examples.aliens