guix.el icon indicating copy to clipboard operation
guix.el copied to clipboard

failed to load modules.

Open trivialfis opened this issue 7 years ago • 16 comments

Running guix-all-packages or guix-number-of-packages (maybe other commands as well) produces the following warning in "Guix REPL", and the displayed total number of packages 1341, which is significantly less than actual number of packages.

  • Guix version : guix (GNU Guix) 05fb1e0017030f1c0cbc7e9a1adeccca57ef1d9d
  • Emacs version: 26.1
  • guix.el version: 20180914 from ~~maple~~ melpa.

Thanks :)

GNU Guile 2.2.4 Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type ,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type ,show c' for details.

Enter `,help' for help. scheme@(guile-user)> ,m (emacs-guix) scheme@(emacs-guix)> warning: failed to load '(gnu packages accessibility)': warning: failed to load '(gnu packages ada)': warning: failed to load '(gnu packages android)': warning: failed to load '(gnu packages animation)': warning: failed to load '(gnu packages avr)': warning: failed to load '(gnu packages axoloti)': warning: failed to load '(gnu packages benchmark)': warning: failed to load '(gnu packages bioconductor)': warning: failed to load '(gnu packages bittorrent)': warning: failed to load '(gnu packages bootloaders)': warning: failed to load '(gnu packages chemistry)': warning: failed to load '(gnu packages chez)': warning: failed to load '(gnu packages ci)': warning: failed to load '(gnu packages commencement)': warning: failed to load '(gnu packages compton)': warning: failed to load '(gnu packages connman)': warning: failed to load '(gnu packages debian)': warning: failed to load '(gnu packages debug)': warning: failed to load '(gnu packages digest)': warning: failed to load '(gnu packages display-managers)': warning: failed to load '(gnu packages education)': warning: failed to load '(gnu packages elixir)': warning: failed to load '(gnu packages emulators)': warning: failed to load '(gnu packages engineering)': warning: failed to load '(gnu packages file-systems)': warning: failed to load '(gnu packages finance)': warning: failed to load '(gnu packages firmware)': warning: failed to load '(gnu packages games)': warning: failed to load '(gnu packages gps)': warning: failed to load '(gnu packages guile-wm)': warning: failed to load '(gnu packages hardware)': warning: failed to load '(gnu packages idris)': warning: failed to load '(gnu packages image-viewers)': warning: failed to load '(gnu packages julia)': warning: failed to load '(gnu packages kodi)': warning: failed to load '(gnu packages license)': warning: failed to load '(gnu packages lirc)': warning: failed to load '(gnu packages lxde)': warning: failed to load '(gnu packages make-bootstrap)': warning: failed to load '(gnu packages mate)': warning: failed to load '(gnu packages maven)': warning: failed to load '(gnu packages microcom)': warning: failed to load '(gnu packages monitoring)': warning: failed to load '(gnu packages ntp)': warning: failed to load '(gnu packages opencl)': warning: failed to load '(gnu packages printers)': warning: failed to load '(gnu packages pumpio)': warning: failed to load '(gnu packages robotics)': warning: failed to load '(gnu packages rust)': warning: failed to load '(gnu packages scheme)': warning: failed to load '(gnu packages security-token)': warning: failed to load '(gnu packages stb)': warning: failed to load '(gnu packages sync)': warning: failed to load '(gnu packages syncthing)': warning: failed to load '(gnu packages syndication)': warning: failed to load '(gnu packages telephony)': warning: failed to load '(gnu packages terraform)': warning: failed to load '(gnu packages tmux)': warning: failed to load '(gnu packages tor)': warning: failed to load '(gnu packages toys)': warning: failed to load '(gnu packages unrtf)': warning: failed to load '(gnu packages vulkan)': warning: failed to load '(gnu packages zile)':

trivialfis avatar Sep 22 '18 02:09 trivialfis

I guess you meant MELPA! :)

I cannot reproduce. Did you just update the package or guix? Then the compiled file cache might be out of date. Remove ~/.cache/guile/ccache and your issue should go.

Ambrevar avatar Sep 22 '18 08:09 Ambrevar

Yes, MELPA, thanks.

I cleared the cache, but it doesn't solve the problem, still failing to load those modules. Is it possible that this is caused by guile-gcrypt?

Currently , guile-gcrypt is in my profile. If I unset GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH, then the following error is generated in message buffer:

Starting Guix REPL ... [5 times] helm-M-x: Error in evaluating guile expression: :17:23: In procedure module-lookup: Unbound variable: %max-returned-list-size

Entering a new prompt. Type ,bt' for a backtrace or ,q' to continue. scheme@(emacs-guix) [1]>

And in REPL buffer:

scheme@(guile-user)> ,m (emacs-guix) While executing meta-command: no code for module (gcrypt hash) scheme@(guile-user)>

And if I remove guile-gcrypt, the same error as above (removing those envs) is generated. I am not quite sure how this is supposed to work.

trivialfis avatar Sep 22 '18 08:09 trivialfis

It might be worth mentioning that the unbound variable error also happens when emacs-guix installed from Guix.

trivialfis avatar Sep 25 '18 06:09 trivialfis

In my experience, installing emacs-guix from both MELPA and emacs-guix can lead to those errors. Try using only one at a time.

Ambrevar avatar Sep 25 '18 07:09 Ambrevar

That's on two different computers.

trivialfis avatar Sep 25 '18 07:09 trivialfis

Hi, I believe this is caused by incorrect load path. In the guix wrapper (the file named guix-command in ~/.config/guix/current/bin), there are lots of (set! %load-path ... ). I tried to export these paths to GUILE_LOAD_PATH in bash and run emacs inside that shell, everything works like a charm. In my case, the exported path is:

export GUILE_LOAD_PATH=$GUILE_LOAD_PATH:/gnu/store/qbzw2ygy1nq2h0nq6sl9cgg1c5mq5g8z-guile-gcrypt-0.1.0/share/guile/site/2.2:/gnu/store/c63g5242rs04ipx1zrkma9zxvs8782sj-gnutls-3.5.18/share/guile/site/2.2:/gnu/store/h9221hw01vx7a0dg279mmyjkl5r6n5fc-libtasn1-4.13/share/guile/site/2.2:/gnu/store/wxrprxdxs0xys5a2wg5hs4x8kcm9366k-libidn2-2.0.4/share/guile/site/2.2:/gnu/store/hawxlh69k0mad5rrv128cinz2svkaxv2-nettle-3.4/share/guile/site/2.2:/gnu/store/fxiwj2wpp11sif613axdax7gmwzsg6kp-zlib-1.2.11/share/guile/site/2.2:/gnu/store/sq5paxxwbhh8lr60gwkx2fvgijs9mcjj-gmp-6.1.2/share/guile/site/2.2:/gnu/store/17d2b12hcxph2m6hilqkv1wl8bm5w98i-guile-git-0.1.0/share/guile/site/2.2:/gnu/store/1aglyrvw57cbw4njc2q4blmbqin3r7k2-guile-bytestructures-1.0.3/share/guile/site/2.2:/gnu/store/sw3wxk3ylxd1kc2z4z4kb5191x9pf17n-guile-json-1.2.0/share/guile/site/2.2:/gnu/store/w7mbgbw223l0zq0m0g986840wvm1m3yk-guile-ssh-0.11.3/share/guile/site/2.2:/gnu/store/rjp81r0sgvix8cplfgqyhyhmyxxk35a6-guile-sqlite3-0.1.0/share/guile/site/2.2

trivialfis avatar Sep 29 '18 10:09 trivialfis

Oops, sorry for the huge delay, I did not notice this issue :blush:

Unfortunately, I don't really know what to do about it.

Apparently, you are right: the problem is in missing guile modules in the load path. If I understand correctly, it happens only on foreign (non-GuixSD) distros. On GuixSD, 'guix' package and all its requirements are installed in the system profile, so they are visible globally, thus there is no need to configure load path.

But if 'guix' is not installed (and only "guix pull" is used), then there are no required guile modules available ("~/.config/guix/current/bin/guix" loads them directly from store as you see), so guile repl does not have access to these modules.

The above is only my guess, but if I am right, the only solution I see is to install 'guix' and 'guile' into ~/.guix-profile. This should set GUILE_LOAD_[COMPILED_]PATH (in ~/.guix-profile/etc/profile), so in theory, this workaround should fix this problem. Please report, if you will try this workaround. Installing 'guix' in the user profile shouldn't make any harm as it will be shadowed by "guix pull"-ed one anyway.

Thank you.

alezost avatar Oct 04 '18 19:10 alezost

Thanks for the reply. Please give me some time to think about it. I'm a little occupied by other stuffs.

trivialfis avatar Oct 04 '18 22:10 trivialfis

Sure, take your time, no need to hurry

alezost avatar Oct 05 '18 17:10 alezost

Hi, I installed guix and guile in my package profile, which indeed fixed the issue. But is there anything we can do to make guix's own profile more "normal"? In the sense the profile in .config acting like other fellow packages?

Thanks.

trivialfis avatar Oct 17 '18 09:10 trivialfis

If guix would have a special environment file, then we could simply load it. But since this environment is "hardcoded" inside ~/.config/guix/current/bin/guix file, I'm afraid the only fix (workaround rather) for this problem on Emacs-Guix side would be to extract the required path from there.

I don't like this solution, but well, it's better than nothing.

I'll let you know when this workaround will be implemented (probably, not very soon)

alezost avatar Oct 17 '18 16:10 alezost

One very simple solution would be making guix a propagated-inputs? But I'm more interested in modifying Guix itself. I will try looking at it later (probably, not very soon). :)

trivialfis avatar Oct 17 '18 23:10 trivialfis

One very simple solution would be making guix a propagated-inputs?

Oh, indeed! I didn't think about it. You are right, this will be a simple workaround. Not sure, if people would like to see that Emacs-Guix propagates Guix into their profiles, though :-)

But I'm more interested in modifying Guix itself.

Hm, do you mean to make guix pull install guile dependencies into ~/.config/guix/current? This would also be a fix, I think.

alezost avatar Oct 18 '18 16:10 alezost

Hm, do you mean to make guix pull install guile dependencies into ~/.config/guix/current? This would also be a fix, I think.

Yes. :)

trivialfis avatar Oct 18 '18 21:10 trivialfis

I wrote:

If guix would have a special environment file, then we could simply load it. But since this environment is "hardcoded" inside ~/.config/guix/current/bin/guix file, I'm afraid the only fix (workaround rather) for this problem on Emacs-Guix side would be to extract the required path from there.

I don't like this solution, but well, it's better than nothing.

I'll let you know when this workaround will be implemented (probably, not very soon)

After looking more at this, I came to the conclusion that this workaround would be too unreliable. Extracting all those %load-paths from the guix script using elisp will be so horribly ugly, that I don't want to do it. Also I don't see a way to extract these paths with guile code. So I'm afraid a fix can come only from Guix itself, for example, if all the required guile modules will be installed into ~/.config/guix/current as @trivialfis suggested.

I think this issue should stay opened until it will be resolved in one way or another.

alezost avatar Dec 19 '18 17:12 alezost

I added a note with a workaround for this problem to README: https://github.com/alezost/guix.el#important-note-for-non-guixsd-users

alezost avatar Jan 25 '19 17:01 alezost