astral-sh / astral-sh/python-build-standalone

Fails to open `libtk8.6.so` on Ubuntu 22.04 when bundled with PyInstaller

Open
#746 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.4k
Forks
314
Avg merge
1d 9h
Merged PRs (30d)
27

Description

We have a PyInstaller binary that we are building that opens a `tk.TopLevel` dialog.

When the executable is launched on Ubuntu 22.04, at the line

```py
import tkinter as tk
```

The follow exception is raised:

```
File "PyInstaller/loader/pyimod02_importers.py", line 457, in exec_module
File "tkinter/__init__.py", line 38, in
ImportError: libtk8.6.so: cannot open shared object file: No such file or directory
```

On Ubuntu 2**4**.04, it _does_ work.

CC @geofft , perhaps related to

- #676

### Motivation

We'd like to make our binaries as portable as possible, and `python-build-standalone` has a low GLIBC requirement that helps with this.

### Environment

- Python 3.13.6 (`python-build-standalone`)
- pyinstaller v6.15.0
- pyinstaller-hooks-contrib v2025.8
- Build environment: `rockylinux:8` container
- `uv` 0.8.8

Contributor guide

Open the contributing guide

Research direction

Reproduce the bundled executable on Ubuntu 22.04, starting from the `import tkinter as tk` entry point and the traceback locations `tkinter/__init__.py` and `PyInstaller/loader/pyimod02_importers.py`. Compare the collected libraries with the working Ubuntu 24.04 build, focusing on why `libtk8.6.so` is unavailable. Done means the bundled binary opens the Tk dialog on Ubuntu 22.04.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, ubuntu
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.