Closed ghost closed 2 years ago
I don't know about Manjaro, but in Debian based systems, Tkinter is an OS module, not a Python one. That's why it worked when you did your equivalent to 'apt install python3-tk' in your system.
You are incorrect, as that error message is specifically related to the python tkinter python module.
Not quite, @eyeonus - that's the right package. There's some OS dependencies as well - namely on tk itself. The distro package not only installs the python component but would depend on that. The confusion comes in because the tkinter
python module does not come from pypi but is a part of python itself and is only be built if tk is on the system. Distro maintainers often package it separately.
In @gqgunhed you may need to figure out how to get your venv wrapper to pass --system-site-packages
to the venv module when building your virtual environment, and make sure you have the appropriate -tk python package from your distro installed.
We can probably close this by now? Unless you'd rather some documentation updates occur first regarding it.
Alternatively I can look into writing up a PR that does a bit more logic and only (tries to) import the GUI code (thus the tkinter module) if it's actually present. That would avoid the issue for folks who run into this and don't actually need/want the GUI.
I see some of this has been done, but some has been missed somewhere as trade --help
on a headless Debian install throws the import exception about tkinter.
If you want to make a PR, I would welcome it.
In general for tkinter Python must be built with TK support at configure/compile time on a system that has appropriate tk libs/headers.
A stackoverflow showing similar issue
Absent a PR or other activity in the last 6 months or so, closing this.
I think this could be helpful for some Linux folks, as this took me a while to figure out:
I use python-virtualenvwrapper to separate my different Python environments from my system. But after running
pip install tradedangerous
I got the following error as I rantrade
.Running
pip install tk tcl pmw
within the Python virtual environment didn't help. So finally I installedtk
into my main system (not into the virtualenv) and everything works fine now.On Manjaro/Arch this is
pacman -S tk
but should be similar on other distros. Hope this is of help for some guys.Fly safe, o7 CMDRs