You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The action fails if the .python-version (passed into python-version-file input) contains a comment #949
- name: Set up Pythonuses: actions/setup-python@v5with:
python-version-file: '.python-version'
The .python-version file
# This file is read by the terraform if var.runtime is unset
3.11
The error
Version # This file is read by the terraform if var.runtime is unset
3.11 was not found in the local cache
Error: The version '# This file is read by the terraform if var.runtime is unset 3.11' with architecture 'x64' was not found for Ubuntu 22.04.
The list of all available versions can be found here: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
Action version:
Latest v5
Platform:
Ubuntu
macOS
Windows
Runner type:
Hosted
Self-hosted
Tools version:
Repro steps:
See above
Expected behavior:
Ignores the comments and only grabs the version
Hello 👋, @nitrocode , The setup-python action does not currently support comments within the .python-version file, which is causing the error you encountered. We appreciate you bringing this to our attention and will consider incorporating comment support in future enhancements. In the meantime, please ensure that the .python-version file contains only the version number without any comments. @olivierlefloch , Regarding specifying multiple versions in the .python-version file, there is an existing feature request to support listing multiple versions. We will consider this for future updates.
Thank you both for your inputs and helping us improve the setup-python action!
Thank you for bringing up this feature request and outlining the scenario involving comments within the .python-version file. We are pleased to inform you that the relevant features and improvements have been implemented as part of PR #787. With this update, the action now properly ignores comment lines in the version file, ensuring only valid Python versions are processed.
As this feature request is now addressed, we are closing this issue. If you encounter any further issues or have additional suggestions, please feel free to open a new issue.
Activity
v-priya-kinthali commentedon Sep 23, 2024
Hello @nitrocode 👋,
Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.
olivierlefloch commentedon Sep 26, 2024
The same issue occurs if multiple versions of python are specified in the
.python-versionfile.v-priya-kinthali commentedon Sep 27, 2024
Hello 👋,
@nitrocode , The
setup-pythonaction does not currently support comments within the.python-versionfile, which is causing the error you encountered. We appreciate you bringing this to our attention and will consider incorporating comment support in future enhancements. In the meantime, please ensure that the.python-versionfile contains only the version number without any comments.@olivierlefloch , Regarding specifying multiple versions in the
.python-versionfile, there is an existing feature request to support listing multiple versions. We will consider this for future updates.Thank you both for your inputs and helping us improve the
setup-pythonaction!v-lmvysakh commentedon May 23, 2025
Thank you for bringing up this feature request and outlining the scenario involving comments within the .python-version file. We are pleased to inform you that the relevant features and improvements have been implemented as part of PR #787. With this update, the action now properly ignores comment lines in the version file, ensuring only valid Python versions are processed.
As this feature request is now addressed, we are closing this issue. If you encounter any further issues or have additional suggestions, please feel free to open a new issue.
nitrocode commentedon May 26, 2025
Thank you very much!