Skip to content

Commit

Permalink
Fix Python externally managed issue on Ubuntu 24.04
Browse files Browse the repository at this point in the history
Fixes actions#10781

Add a non-externally managed Python interpreter to the `ubuntu-24.04` runner image to avoid pip installation errors.

* **Template Update**
  - Add a provisioner in `images/ubuntu/templates/ubuntu-24.04.pkr.hcl` to install a stand-alone Python interpreter.
  - Update environment variables to include the new Python path.

* **Toolset Update**
  - Specify non-externally managed Python installations in `images/ubuntu/toolsets/toolset-2404.json`.

* **Documentation Update**
  - Document the inclusion of a non-externally managed Python interpreter in `images/ubuntu/Ubuntu2404-Readme.md`.
  - Note the resolution of pip installation errors.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/actions/runner-images/issues/10781?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
Karinza38 committed Dec 22, 2024
1 parent 45226c1 commit 6723375
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion images/ubuntu/Ubuntu2404-Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Kotlin 2.1.0-release-394
- Node.js 20.18.1
- Perl 5.38.2
- Python 3.12.3
- Python 3.12.3 (non-externally managed)
- Ruby 3.2.3
- Swift 6.0.3

Expand Down
11 changes: 11 additions & 0 deletions images/ubuntu/templates/ubuntu-24.04.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,15 @@ provisioner "shell" {
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
}

provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
script = "${path.root}/../scripts/build/install-standalone-python.sh"
}

provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
inline = ["export PATH=/opt/standalone-python/bin:$PATH"]
}
}
3 changes: 2 additions & 1 deletion images/ubuntu/toolsets/toolset-2404.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"3.10.*",
"3.11.*",
"3.12.*"
]
],
"non_externally_managed": true
},
{
"name": "PyPy",
Expand Down

0 comments on commit 6723375

Please sign in to comment.