alezost / guix.el

Emacs interface for GNU Guix package manager
https://emacs-guix.gitlab.io/website/
GNU General Public License v3.0
139 stars 16 forks source link

Can't view packages for Guix on Debian #29

Closed leungbk closed 5 years ago

leungbk commented 5 years ago

I'm running a Guix-managed installation of Emacs 26.1 on my Debian computer. I'm having trouble doing most things with your Guix frontend, though. Here's what happens upon trying to view my Guix packages:

(setq debug-on-error t)

(require 'geiser)
(require 'guix)
Debugger entered--Lisp error: (error "Error in evaluating guile expression: <unnamed port>:17:23: In procedure module-lookup: Unbound variable: %max-returned-list-size\n\nEntering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.\nscheme@(emacs-guix) [1]> ")
  signal(error ("Error in evaluating guile expression: <unnamed port>:17:23: In procedure module-lookup: Unbound variable: %max-returned-list-size\n\nEntering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.\nscheme@(emacs-guix) [1]> "))
  error("Error in evaluating guile expression: %s" "<unnamed port>:17:23: In procedure module-lookup: Unbound variable: %max-returned-list-size\n\nEntering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.\nscheme@(emacs-guix) [1]> ")
  guix-geiser-eval("(begin (set! %max-returned-list-size 10)(set! %temporary-directory \"/tmp/emacs-guix-Ivsyqk\"))" #<buffer *Guix Internal REPL*>)
  guix-eval("(begin (set! %max-returned-list-size 10)(set! %temporary-directory \"/tmp/emacs-guix-Ivsyqk\"))")
  guix-repl-configure-guile-side()
  run-hooks(guix-repl-after-start-hook)
  guix-start-repl-maybe(nil "Starting Guix REPL ..." nil)
  guix-start-process-maybe()
  guix-get-repl-buffer(internal)
  guix-eval-read("(help-string )")
  guix-help-string(nil)
  guix-command-parse-arguments(nil)
  guix-command-all-arguments(nil)
  guix-command-arguments(nil)
  guix-command-generate-popup(guix-popup nil)
  guix(nil)
  funcall-interactively(guix nil)
  call-interactively(guix record nil)
  command-execute(guix record)
  execute-extended-command(nil "guix" "guix")
  funcall-interactively(execute-extended-command nil "guix" "guix")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

M-x guix doesn't seem to be working for me with the above minimal config using guix-installed versions of these packages. I'd appreciate any help. I'm using Geiser v 0.10 and Guile 2.2.4. Thanks for your time.

alezost commented 5 years ago

Hello, sorry for the delay. Could you tell, what is your geiser version (you may check with M-x geiser-version) and how did you install Geiser and Emacs-Guix?

alezost commented 5 years ago

By the way, although it does not look like it, but maybe this is the same as https://github.com/alezost/guix.el/issues/28

Could you try to install (with guix package -i) guix and guile into your guix profile and check if this problem stays.

leungbk commented 5 years ago

Thanks for your response! I've followed your suggestions and updated my original post with a slightly different backtrace.

alezost commented 5 years ago

OK, so what is your geiser version and how did you install Geiser and Emacs-Guix?

Also please show the output of (guix-repl-guile-args). You may run it in M-x ielm, for example.

leungbk commented 5 years ago

Sorry, I had edited my initial post to answer those but didn't make it clear--my Geiser version is 0.10 and I installed Geiser and Emacs Guix via guix package -i.

Here's my output for (guix-repl-guile-args):

("-L" "/gnu/store/0db00065vhmy5qkpkgrnvxhxrc0mbp6z-emacs-guix-0.5/share/guile/site/2.2" "-C" "/gnu/store/0db00065vhmy5qkpkgrnvxhxrc0mbp6z-emacs-guix-0.5/lib/guile/2.2/site-ccache" "-L" "/home/brian/.config/guix/current/share/guile/site/2.2" "-C" "/home/brian/.config/guix/current/lib/guile/2.2/site-ccache" "-L" "/gnu/store/mdw00a2sq0qqyzqygmp9035g8r2rlslj-guix-0.15.0-8.71a78ba/share/guile/site/2.2" "-C" "/gnu/store/mdw00a2sq0qqyzqygmp9035g8r2rlslj-guix-0.15.0-8.71a78ba/lib/guile/2.2/site-ccache" "--listen=/tmp/emacs-guix-jKMjv0/repl-socket")
alezost commented 5 years ago

Hm, have you ever installed Emacs-Guix with MELPA or only with guix? (mixing these 2 installations may lead to errors). In any case you may try to remove ~/.cache/guile/ccache. This is a safe operation: this directory contains Guile cache (.go files), and there may be some "stale" .go files that are incompatible with the according .scm files, so removing this dir may solve error-prone incompatibility problems.

Also I see that you use Emacs-Guix 0.5 which is not the latest version. Could you please do guix pull and update Emacs-Guix (its current version is 0.5.1).

leungbk commented 5 years ago

Thanks for your response. I wound up installing GuixSD since there was something wrong with my Debian installation anyway. Everything seems to work okay now.

TxGVNN commented 5 years ago

Hi, I also installed Guix in Debian 9, and I also get the errors to look like yours. And today, I found that If I export GUILE_LOAD_PATH, the issue has resolved

export GUILE_LOAD_PATH="$HOME/.guix-profile/share/guile/site/2.2${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"  

If you still keep the Debian version, you can try it.

alezost commented 5 years ago

@TxGVNN, I think the right way to set the guix environment is to add source "$HOME/.guix-profile/etc/profile" to your ~/.bash_profile as it is recommended in the guix manual.

That etc/profile file should contain GUILE_LOAD_PATH and all other environment variables.

TxGVNN commented 5 years ago

If I run source "$HOME/.guix-profile so GUILE_LOAD_PATH=~/.config/guix/current/share/guile/site/2.2. After that run guix in Emacs still get error.

If I export GUILE_LOAD_PATH=/.guix-profile/share/guile/site/2.2, it works well. So, as I see

~/.guix-profile         -> /var/guix/profiles/per-user/gtranxuan/guix-profile
~/.config/guix/current  -> /var/guix/profiles/per-user/gtranxuan/current-guix

Could you explain the difference bettween guix-profile and current-guix?

alezost commented 5 years ago

If I run source "$HOME/.guix-profile so GUILE_LOAD_PATH=~/.config/ guix/current/share/guile/site/2.2. After that run guix in Emacs still get error.

If I export GUILE_LOAD_PATH=/.guix-profile/share/guile/site/2.2, it works well.

Oh, this is very interesting! Could please show the value of GUILE_LOAD_PATH in both cases?

So, as I see

~/.guix-profile -> /var/guix/profiles/per-user/gtranxuan/guix-profile ~/.config/guix/current -> /var/guix/profiles/per-user/gtranxuan/current-guix

Could you explain the difference bettween guix-profile and current-guix?

guix-profile is where your packages are installed by default (I mean when you run guix package -i).

current-guix is the profile populated by guix pull. Only guix itself (its latest version fetched by guix pull) is installed there.

TxGVNN commented 5 years ago

Oh, this is very interesting! Could please show the value of GUILE_LOAD_PATH in both cases?


└>ls -la ~/.config/guix/current/share/guile/site/2.2/
total 36
dr-xr-xr-x 2 root root 4096 Jan  1  1970 .
dr-xr-xr-x 3 root root 4096 Jan  1  1970 ..
lrwxrwxrwx 2 root root   87 Jan  1  1970 chromium -> /gnu/store/8x6cxifp5rsj12wxycf95yxamnr0zd0j-guix-chromium/share/guile/site/2.2/chromium
lrwxrwxrwx 2 root root   83 Jan  1  1970 gnu -> /gnu/store/dhvfgdiws3gxbn9fw7r53s4zwqzx0gkx-guix-eac5d425c/share/guile/site/2.2/gnu
lrwxrwxrwx 2 root root   87 Jan  1  1970 gnu.scm -> /gnu/store/dhvfgdiws3gxbn9fw7r53s4zwqzx0gkx-guix-eac5d425c/share/guile/site/2.2/gnu.scm
lrwxrwxrwx 2 root root   84 Jan  1  1970 guix -> /gnu/store/dhvfgdiws3gxbn9fw7r53s4zwqzx0gkx-guix-eac5d425c/share/guile/site/2.2/guix
lrwxrwxrwx 2 root root   88 Jan  1  1970 guix.scm -> /gnu/store/dhvfgdiws3gxbn9fw7r53s4zwqzx0gkx-guix-eac5d425c/share/guile/site/2.2/guix.scm
lrwxrwxrwx 2 root root   91 Jan  1  1970 pre-inst-env -> /gnu/store/8x6cxifp5rsj12wxycf95yxamnr0zd0j-guix-chromium/share/guile/site/2.2/pre-inst-env
lrwxrwxrwx 2 root root   89 Jan  1  1970 README.org -> /gnu/store/8x6cxifp5rsj12wxycf95yxamnr0zd0j-guix-chromium/share/guile/site/2.2/README.org

┌(gtranxuan@linagora)─(~)─(10:02:37) └>ls -la ~/.guix-profile/share/guile/site/2.2/ total 20 dr-xr-xr-x 2 root root 4096 Jan 1 1970 . dr-xr-xr-x 3 root root 4096 Jan 1 1970 .. lrwxrwxrwx 3 root root 92 Jan 1 1970 emacs-guix -> /gnu/store/qlyjk7763kq0jddlzf35490z6qmlb6ds-emacs-guix-0.5.1/share/guile/site/2.2/emacs-guix lrwxrwxrwx 3 root root 96 Jan 1 1970 emacs-guix.scm -> /gnu/store/qlyjk7763kq0jddlzf35490z6qmlb6ds-emacs-guix-0.5.1/share/guile/site/2.2/emacs-guix.scm lrwxrwxrwx 6 root root 90 Jan 1 1970 gcrypt -> /gnu/store/idskkmlpd2cd42gnfidf5wj Quite difference, that is reason I ask you what differencewj5qc8yxr-guile-gcrypt-0.1.0/share/guile/site/2.2/gcrypt


Quite a difference, that is the reason I asked you
TxGVNN commented 5 years ago

guix-profile is where your packages are installed by default (I mean when you run guix package -i).

current-guix is the profile populated by guix pull. Only guix itself (its latest version fetched by guix pull) is installed there.

Thanks for your help, actually I install emacs-guix by guix package -i emacs-guix, seems this is the reason why I have to export to guix-profile instead of current-profile.

Could you suggest the best practice?

alezost commented 5 years ago

I don't know what the best practice is, but I would do the following:

  1. Install guix and guile into your user profile:

    guix package -i guile guix

    This guarantees that all Guile modules required by Guix will be available for external programs (in particular, for Guile and Emacs-Guix).

  2. Export the environment, by adding the following to your ~/.bash_profile:

    source "$HOME/.guix-profile/etc/profile"
    source "$HOME/.config/guix/current/etc/profile"

    Note, that the "current" profile should be sourced the last to make sure the latest guix fetched by guix pull has a priority.

I think this configuration is safe, and both Guix and Emacs-Guix should work with it without any problem (in theory :smile:).

alezost commented 5 years ago

@TxGVNN I have added a note with a workaround described above to README: https://github.com/alezost/guix.el#important-note-for-non-guixsd-users

TxGVNN commented 5 years ago

Thank you, It will help many people to go to the right way.