Repository navigation
Python setup.sh deleting major version directory instead of arch specific directory #1255
Description
Activity
- changed the title
[-]setup.sh deleting najor version directory[/-][+]Python setup.sh deleting major version directory instead of arch specific directory[/+]on Dec 8, 2025 Hello @fergoid👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.Hi @fergoid,
The bug exists in the setup.sh script that's bundled inside Python release archives. The script was incorrectly deleting the entire version directory instead of just the architecture-specific subdirectory.
Resolution:
This was fixed in actions/python-versions#319 (February 20, 2025).
Fixed Code:
if [ ! -d $PYTHON_TOOLCACHE_PATH ]; then
echo ""Creating Python hostedtoolcache folder...""
mkdir -p $PYTHON_TOOLCACHE_PATH
elif [ -d $PYTHON_TOOLCACHE_VERSION_ARCH_PATH ]; then
echo ""Deleting Python $PYTHON_FULL_VERSION ($ARCH)""
rm -rf $PYTHON_TOOLCACHE_VERSION_ARCH_PATH
fiHowever, since the fix is in the installer template, only Python versions built after this date contain the fix.
Recommended Actions:
-
Upgrade to Python versions built after February 2025:
Python 3.12.11+ (for 3.12.x series)
Python 3.13.4+ (for 3.13.x series) -
Update to actions/setup-python@v6
-
Clear your existing tool cache to get fresh installations:
rm -rf $RUNNER_TOOL_CACHE/Python/
This should resolve the issue with matrix installations overwriting each other. Please let us know if you have any questions!
-
Hi @fergoid,
Just wanted to follow up on this issue. Were you able to try the recommended actions mentioned above?
Please let us know if the fix resolved your issue or if you're still experiencing problems. If everything is working as expected, we can go ahead and close this issue.
Thanks!
Hi , no I haven't tried it but we have numerous versions of Python in use so whilst it may work in some situations, it will still be an issue for us. Happy to close this issue though.
Hi @fergoid,
Just wanted to follow up on this issue. Were you able to try the recommended actions mentioned above?
Please let us know if the fix resolved your issue or if you're still experiencing problems. If everything is working as expected, we can go ahead and close this issue.
Thanks!
Hi @fergoid,
We’re going to close this issue.If you’re still running into this behavior with the latest version of
actions/setup-pythonafter making those adjustments, please feel free to re-open this issue with updated logs and details about your configuration so we can continue to investigate and refine the behavior.
Description:
When I use setup-python with a matrix (e.g. arch: [arm, x86]). The setup script (setup.sh) that is being run will delete the Python version directory (e.g. python3.12.8) and not the architecture specific version. This means if I use a matrix and install 'arm' first the 'x86' install will delete the 'arm' installation before proceeding.
We observed this because we want to cache Python runtimes in a shared resource so they can be used by our self hosted runners. We will run scheduled workflows that install/refresh all of the cached versions we need.
Action version:
v6
Platform:
Runner type:
Tools version:
Install any Python version using a matrix.
Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
Expected behavior:
The setup script should delete the architecture specific directory only.
Actual behavior:
You can see clearly from this snippet of the script what is happening
We can work around this by using
max-parallel: 1in our matrix configuration but this significantly slows down our refreshes.