I have a program that I wrote, maybe I didn’t package it appropriately, but I cannot got it to run. I wrote it on a manjaro install, and tested it on another manjaro install, both were fine. I packaged it with poetry and copied the wheel over.
Today I tried to install it on my nixos surface tablet I use at work. I get this error on installation:
Traceback (most recent call last): File "/home/gzuh/.local/bin/willcallgui", line 5, in <module>
from willcallgui import willcallgui
File "/home/gzuh/.local/share/pipx/venvs/willcallgui/lib/python3.11/site-packages/willcallgui/willcallgui.py", line 12, in <module>
import tkinter as tk
File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_tkinter'
These are the packages i have installed… I’m trying to install it with pipx…
environment.systemPackages = with pkgs; [
vim
wget
screen
google-chrome
openssh
blackbox-terminal
tailscale
gnome.gnome-tweaks
imagemagick
git
python311Full
python311Packages.tkinter
python311Packages.pip
python311Packages.pipx
];
What am i missing?
Not 100% sure becuase I don’t know you’re full environment, but tkinter sometimes requires an additional OS level install. I know Ubuntu requires something like “sudo apt install python3.10-tk”.
Not familiar with NixOS, but saw somethings mentioning “nix-env -i python3-tkinter”, but no idea if that’s a real command.
Well i got python311.Packages. tkinter
Sorry I missed that in the code block. I tried to dive a bit deeper, but it looks like there are different ways to build a python env in NixOS and the issues you’re running into could depend on your build process.
Found this documentation, but it’s a bit dense for me given my lack of experience with NixOS.
Best of luck though!
This documentation is the right place to look - specifically, I think you need to use
python.withPackages
rather than trying to pull in each package as a separate item