-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Description of the issue
When trying to run PyInstaller in a GitHub environment setup by https://github.com/astral-sh/uv, I get the following error:
https://github.com/Toufool/AutoSplit/actions/runs/13106302183/job/36561641009?pr=313#step:5:163
26802 WARNING: TclTkInfo: failed to obtain Tcl/Tk info: Child process call to _get_tcl_tk_info() failed with:
File "/home/runner/work/AutoSplit/AutoSplit/.venv/lib/python3.11/site-packages/PyInstaller/isolated/_child.py", line 63, in run_next_command
output = function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/AutoSplit/AutoSplit/.venv/lib/python3.11/site-packages/PyInstaller/utils/hooks/tcl_tk.py", line 60, in _get_tcl_tk_info
"tkinter_extension_file": _tkinter.__file__,
^^^^^^^^^^^^^^^^^
AttributeError: module '_tkinter' has no attribute '__file__'
Your platform does not support the splash screen feature, since tkinter is not installed. Please install tkinter and try again.
Looks like this issue was introduced in https://github.com/pyinstaller/pyinstaller/pull/8722/files#diff-63a9cf452f7a379d945e5f6ba92a579b783c471f3babe2d74ff2696610d727c4R60
Whilst searching for similar issues, I found that matplotlib had a similar issue with TK. Quoting from
matplotlib/matplotlib#23074 :
In the python-build-standalone cpython distributions,
_tkinter
is doesn't have a separate shared library and therefore also doesn't have a__file__
attribute, causing a crash
astral-sh/python-build-standalone#129
On system python, _tkinter is a shared library (
/usr/lib/python3.8/lib-dynload/_tkinter.cpython-38-x86_64-linux-gnu.so
), while in these python builds it's a builtin module which does not have__file__
.
astral-sh/python-build-standalone#129 (comment)
My general response to this is:
__file__
is documented as optional by Python: any code requiring__file__
is bugged and should instead be using a mechanism described in pyoxidizer.readthedocs.io/en/pyoxidizer-0.20.0/oxidized_importer_resource_files.html.
Context information (for bug reports)
- Output of
pyinstaller --version
:6.11.1
- Version of Python: 3.11-3.13
- Platform: Linux Ubuntu 22.04
- How you installed Python:
jobs:
Build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up uv for Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python-version }}
-
Did you also try this on another platform? Does it work there?
Yes. It works fine on Windows and my local WSL2 (Ubuntu) instance -
try the latest development version, using the following command:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
- follow all the instructions in our "If Things Go Wrong" Guide
(https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
Make sure everything is packaged correctly
- start with clean installation
- use the latest development version
- [N/A] Run your frozen program from a command window (shell) — instead of double-clicking on it
- Package your program in --onedir mode
- Package without UPX, say: use the option
--noupx
or setupx=False
in your .spec-file - Repackage you application in verbose/debug mode. For this, pass the option
--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.
A minimal example program which shows the error
distribution=cpython-3.13.1+20250115-x86_64_v3-unknown-linux-gnu-pgo+lto-full
wget https://github.com/astral-sh/python-build-standalone/releases/download/20250115/$distribution.tar.zst
tar xf $distribution.tar.zst
python/install/bin/python3 -m venv venv
venv/bin/pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
touch example.py
venv/bin/pyinstaller example.py --splash=foo.png --onedir --noupx --debug=all
Stacktrace / full error message
1476 INFO: PyInstaller: 6.11.1, contrib hooks: 2025.1
1477 INFO: Python: 3.13.1
1479 INFO: Platform: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.31
1479 INFO: Python environment: /mnt/e/Users/Avasam/Documents/Git/test/venv
1481 INFO: wrote /mnt/e/Users/Avasam/Documents/Git/test/example.spec
1626 INFO: Module search paths (PYTHONPATH):
['/mnt/e/Users/Avasam/Documents/Git/test/python/install/lib/python313.zip',
'/mnt/e/Users/Avasam/Documents/Git/test/python/install/lib/python3.13',
'/mnt/e/Users/Avasam/Documents/Git/test/python/install/lib/python3.13/lib-dynload',
'/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages',
'/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/setuptools/_vendor',
'/mnt/e/Users/Avasam/Documents/Git/test']
3626 INFO: checking Analysis
3630 INFO: Building because noarchive changed
3630 INFO: Running Analysis Analysis-00.toc
3630 INFO: Target bytecode optimization level: 0
3630 INFO: Initializing module dependency graph...
3646 INFO: Initializing module graph hook caches...
3780 INFO: Analyzing modules for base_library.zip ...
9734 INFO: Processing standard module hook 'hook-encodings.py' from '/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/hooks'
12749 INFO: Processing standard module hook 'hook-pickle.py' from '/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/hooks'
13882 INFO: Processing standard module hook 'hook-heapq.py' from '/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/hooks'
14569 INFO: Caching module dependency graph...
14642 INFO: Looking for Python shared library...
14651 INFO: Using Python shared library: /mnt/e/Users/Avasam/Documents/Git/test/python/install/lib/libpython3.13.so.1.0
14651 INFO: Analyzing /mnt/e/Users/Avasam/Documents/Git/test/example.py
14654 INFO: Processing module hooks (post-graph stage)...
14657 INFO: Performing binary vs. data reclassification (1 entries)
14678 INFO: Looking for ctypes DLLs
14681 INFO: Analyzing run-time hooks ...
14682 INFO: Including run-time hook 'pyi_rth_inspect.py' from '/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/hooks/rthooks'
16854 INFO: Looking for dynamic libraries
17331 INFO: Warnings written to /mnt/e/Users/Avasam/Documents/Git/test/build/example/warn-example.txt
17344 INFO: Graph cross-reference written to /mnt/e/Users/Avasam/Documents/Git/test/build/example/xref-example.html
17378 INFO: checking PYZ
17381 INFO: Building because toc changed
17381 INFO: Building PYZ (ZlibArchive) /mnt/e/Users/Avasam/Documents/Git/test/build/example/PYZ-00.pyz
17420 INFO: Building PYZ (ZlibArchive) /mnt/e/Users/Avasam/Documents/Git/test/build/example/PYZ-00.pyz completed successfully.
17423 INFO: TclTkInfo: initializing cached Tcl/Tk info...
17738 WARNING: TclTkInfo: failed to obtain Tcl/Tk info: Child process call to _get_tcl_tk_info() failed with:
File "/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/isolated/_child.py", line 63, in run_next_command
output = function(*args, **kwargs)
File "/mnt/e/Users/Avasam/Documents/Git/test/venv/lib/python3.13/site-packages/PyInstaller/utils/hooks/tcl_tk.py", line 60, in _get_tcl_tk_info
"tkinter_extension_file": _tkinter.__file__,
^^^^^^^^^^^^^^^^^
AttributeError: module '_tkinter' has no attribute '__file__'. Did you mean: '__name__'?
Your platform does not support the splash screen feature, since tkinter is not installed. Please install tkinter and try again.
Build logs: build.zip
Please also see https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs
for more about what would use to solve the issue.