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?

  • jacksilver@lemmy.world
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    25 days ago

    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!

    • hornface@fedia.io
      link
      fedilink
      arrow-up
      2
      ·
      24 days ago

      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