emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Command not found when using Org + Guix + envrc.el


From: Fabio Natali
Subject: Command not found when using Org + Guix + envrc.el
Date: Sun, 16 Apr 2023 15:56:24 +0100

Hi!

I tend to set up my literate programming projects with:

- Emacs and Org
- Guix, to install the dependencies and create a development environment
- direnv, to automatically load the Guix environment
- envrc.el, to use direnv from Emacs

It's a great setup and I'm very grateful to the above projects, but
there are a few corner cases where things don't work as expected.

For instance:

- Define a Guix environment that includes Python (Python not being
  installed on the system otherwise)
- Create an envrc file that activates the Guix environment, e.g. via
  ~eval "$(guix shell --search-paths --manifest="$1")~
- In the same folder, create an Org file with a Python block

The block is evaluated correctly when a new Emacs instance is launched
from within the folder, and therefore from within the activated
environment.

However, things don't work as expected when using emacsclient with an
existing Emacs server. Thanks to envrc.el the Guix environment gets
apparently activated in the buffer, as confirmed by the envrc flag in
the modeline and by the output of =(getenv "PATH")=. However, evaluating
the block results in the following error:

#+begin_quote
/bin/bash: line 1: python: command not found
[ Babel evaluation exited with code 127 ]
#+end_quote

Tangentially, if the block's header includes =:session=, as in
=#+begin_src python :session=, then the error is slightly different and
is displayed in the minibuffer as opposed to a separate buffer:

#+begin_quote
make-process--with-editor-process-filter: Searching for program: No such file 
or directory, python
#+end_quote

Things work fine when manually setting =org-babel-python-command=, but
hardcoding the Guix store path is clearly inconvenient, to start with
it'd require constant update.

#+begin_quote
(setq-local org-babel-python-command "/gnu/store/...")
#+end_quote

Does anyone have any idea on how to investigate this further? I'm still
unsure whether this may have to do with envrc.el, Org Babel, or possibly
with some quirks in my configuration.

Thanks, cheers, Fabio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]