Can't seem to start tk/tcl interface in linux "can't find package Img"

37 views
Skip to first unread message

Joshua Scholar

unread,
Jun 15, 2026, 5:48:18 PM (8 days ago) Jun 15
to Shen
Using Kubuntu (Ubuntu with the KDE interface) I installed the latest version of SBCL (2.6.5) then I installed Shen from the S41.1 source archive, answering yes to install the tcl/tk support and giving it a directory for that (as well as installing everything else).

I had already installed tcl/tk from the command line.  It seems to be version 8.6.14 

When I follow the instructions to run "wish root.tcl" from the directory for shentk it does create a little window.

But when I run (ide.myIDE) in the repl, I get the error "can't find package Img"

The TCL window does change color to blue at that point so I guess it did communicate.

Joshua Scholar

unread,
Jun 15, 2026, 6:14:58 PM (7 days ago) Jun 15
to Shen
I got a step further by realizing that it was a missing tcl package.

I installed libtk.img

But now Shen's error is "couldn't open logo3.png: no such file or directory"

dr.mt...@gmail.com

unread,
Jun 15, 2026, 7:10:39 PM (7 days ago) Jun 15
to Shen
logo3.png is a file in the download.  It displays the Shen logo.
Possibly it needs to be relocated somewhere in your installation
like your Shen home directory.

Mark

dr.mt...@gmail.com

unread,
Jun 15, 2026, 7:31:33 PM (7 days ago) Jun 15
to Shen
logo3.png is part of the IDE download and is used in Lib/IDE/ide.shen
(tk.image splogo "logo3.png")

So Tcl/Tk is looking for it relative to the current working directory. Try launching Shen from the directory containing logo3.png, or copy logo3.png into the directory from which you start Shen. Alternatively, change the line to use an absolute path to the image.

Mark


On Monday, 15 June 2026 at 23:14:58 UTC+1 joshua...@gmail.com wrote:

Joshua Scholar

unread,
Jun 15, 2026, 8:19:26 PM (7 days ago) Jun 15
to Shen
Ok I fixed that. I ran wish from the outer directory where that file is.
Sorry to bother you. 

Maybe this will be useful to some people.  Some problems and work arounds. 

A couple of other things.  The arrow keys in the repl don't work, neither on the sbcl version nor on the chez scheme version.  Wrapping with rlwrap didn't seem to fix it, at least when I tried that with the scheme version inside of nix.

But what DOES work is running the repl inside of emacs. 

That itself took some work. There's a shen mode for emacs in ELPA but as the people here probably know you pretty much need the GNU-devel version.  So here's a copy of my .emacs file to give people an idea how to get that.  It also shows that I have envrc (supporting direnv to work with nix) installed and I'm suppression some warnings from both shen-mode and envrc.

*****************************************************************************
;; ==========================================
;; 1. PACKAGE ENGINE & ARCHIVE CONFIGURATION
;; ==========================================
(require 'package)
;; Add standard MELPA and the GNU-devel repository containing the fixed code
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu-devel" . "https://elpa.gnu.org/devel/") t)
(package-initialize)

;; Pin shen-mode exclusively to the development branch to fix the macro bug
(setq package-pinned-packages
      '((shen-mode . "gnu-devel")))

;; ==========================================
;; 2. AUTOMATIC PROFILE DATA (SYSTEM PACKAGES)
;; ==========================================
(custom-set-variables
 '(package-selected-packages '(envrc shen-mode)))
(custom-set-faces
 )

;; ==========================================
;; 3. LANGUAGE MODE HOOKS & BINARY PATH OVERRIDES
;; ==========================================

;; Force Emacs to load .shen extensions with the major mode
(add-to-list 'auto-mode-alist '("\\.shen\\'" . shen-mode))

(with-eval-after-load 'shen-mode
  (setq inferior-shen-program "shen-scheme"))

(add-hook 'shen-mode-hook
          (lambda ()
            (setq inferior-shen-program "shen-scheme")
            ;; CRITICAL: Bind your local Nix Chez Scheme engine to the interactive hooks
            (setq scheme-program-name "shen-scheme")
            (setq inferior-lisp-program "shen-scheme")))

;; ==========================================
;; 4. DEPLOYMENT AND ENVIRONMENT DAEMONS
;; ==========================================

;; Start the Envrc tool to automatically map your Nix directory environment
(add-hook 'after-init-hook 'envrc-global-mode)
;; Suppress the annoying async native compilation warning popups
(setq native-comp-async-report-warnings-errors 'silent)

********************************************************************************

The first time you load this in emacs you have to run" M-x package-refresh-contents" and then "M-x package-install" then enter "shen-mode" and if you were like me and needed envrc, you'd have to do that again for envrc.

Another problem is that you need a shen repl running so that's "M-x run-shen"
If you are trying a version of shen that depends on a nix directory with flake and direnv (which is how I run the chez version, with a slightly different .emacs file where the shen executable is just "shen-scheme").  Then you'll need to load a shen file from that directory so that the environment variables are pointing at that version of shen and run that "M-x run-shen" command while that buffer is on top.
Unfortunately while you can run the shen ide code this way, you can't run your own tk tcl files through the same copy of wish and the same repl.  So if you run (ide.myIDE) inside of the emacs shen repl you won't be running any other shen tk programs through it.
You can close the ide and restart wish, but you also have to restart the repl.  There might be some way to clear it, but I haven't learned it yet. 
I've seen some older discussions online that the ways to exit shen are platform specific.  So for the scheme version it's (scm.exit) and you have to have (tc -) first.
Some people say that (cl.exit) worked but now the way to exit sbcl is (sb-ext:quit) but shen doesn't understand (cl.sb-ext:quit) there may be some way to do that, but I don't know it yet. So instead I go to the *inferior-shen* buffer, pull down "Signals" and select "BREAK".  That gives me a menu where hitting "1" followed by return exits shen.  Then you can close the buffer and start run-shen all over again.
Unfortunately to test tk shen programs you seem to have to restart shen and wish every time.
Note, the shen-mode keys to run a file are "c-c c-l" 
Reply all
Reply to author
Forward
0 new messages