Re: A dream?
Hi Pedro, Do you mind to share those slides? I am teaching too and that will help me a lot Thanks in advance - Adolfo On Mon, Apr 17, 2023, at 23:35, Pedro Andres Aranda Gutierrez wrote: > > Jean Louis : > >> Eduardo Ochs [2023-04-16 01:45]: > >> do you have a page in https://gnu.support/ explaining in detail how > >> you teach Emacs to beginners? It would be nice to have something like > >> that... > > > >I just tell them to do Emacs Tutorial. There is no need for page when > >it is built-in. > > > >I tell them, open Emacs and do the tutorial, then let me know. Later > >we do not talk much, we just do the work. > > In addition to that, I have also collected a set of slides with suggestions > and > quick answers to some of the configuration hurdles. That helps a lot (they > say) > In addition, I have an article on org-mode. > I submitted to the (wrong) journal and never got published on paper ,-( > That was a couple of years ago and I have continued to update it for my > personal > reference. When people have specific interest in org-mode I pass > the lastest version in PDF and org for them to play around. The teaser for > this > is any of my lecture handouts. > > Best, /PA > > -- > Fragen sind nicht da, um beantwortet zu werden, > Fragen sind da um gestellt zu werden > Georg Kreisler > > Headaches with a Juju log: > unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run a > leader-deposed hook here, but we can't yet
Re: Command not found when using Org + Guix + envrc.el
I am facing the same problem, hopefully some one can help us - A On Sun, Apr 16, 2023, at 08:56, Fabio Natali wrote: > 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.
org-babel not finding executables when using direnv [Was: Re: ob-sql is not finding psql when using direnv+guix]
On Wed, May 12, 2021, at 08:49, Cook, Malcolm wrote: > > > >I am using Guix with direnv. > > > > > > What is your shell? > > > > > > > My shell is bash, originally I was using zsh and I thought that was the > > problem, so I switched to bash and still not working. > > > > > How/When do you "hook direnv into your shell" (https://direnv.net/)? > > > > > > > In the .profile file, at login. > > > > > > In an specific folder I am installing and using psql and postgresql > > > > using direnv+guix as follows: > > > >use guix --manifest=cdpp-manifest.scm > > > > > > > >export PGUSER=food_user > > > >export PGPASSWORD=some_password > > > >export PGDATABASE=food > > > > > > > >layout postgres > > > > > > When are you doing this? > > > > > > a) in the "specific folder"'s .envrc file? > > > b) in an org-mode shell block that you execute prior to the sql block? > > > c) ?? > > > > Option (a) > > > > > > > You seem to be following [Per\-project > > > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/) > > > but with guix instead of nix. Nice. > > > > > > > Yep, great post. direnv + guix change the way I develop software, do data > > science and write lectures and papers. > > > > > If you enter the directory and then call emacs, earthing should just > > > work, no changes neede. > > > > > > > It works for almost everything (sql-buffers, python buffers, etc), except > > for org-babel sql blocks. > > > > I am using EXWM, so emacs is always on. > > > > > > > If you want to tell emacs to adopt the environment established by a > > > .direnv, you probably want [direnv integration for > > > emacs\.](https://github.com/wbolster/emacs-direnv) > > > > > > > emacs-direnv was my first choice, but then I changed to envrc > > (https://github.com/purcell/envrc) . In both I got the error. > > > > I see. Envrc looks superior. Good to know. > > You've covered all my bases. Shooting in the dark, I would > confirm/check the following: > I have news: It fails for python too. Using the same files as before and this block: #+begin_src python import pandas as pd import matplotlib.pyplot as plt #+end_src It finds matplotlib, but fails to find pandas. I tried the same trick as before (but with the python executable, no psql), added the line (org-babel-python-command . ".direnv/.guix-profile/bin/python3") but is not working. But if I am in shell, or in a python buffer or in a inferior-python process Emacs is finding all the libraries and executables. So, I am assumming that the problem lies in how org-babel searchs the path ... Answers to your questions below: > How do you know that envrc is working otherwise? > > When you switch to a direnv controlled buffer do you get any > informative diagnostics in *Messages*? > Yes > Do you get any more if you first `(setq envrc-debug t)`? > Didn't try, Will do later > Is this buffer in the same directory as the .direnvrc file? > Yes > Presumably TRAMP is not in the mix in any way. > No > Variable sql-postgres-program is unchanged from default value of psql > > What is result of > > m-x shell-command > which psql > Is empty when I am not in a direnv controlled directory, the correct path when I enter to those directories. > and does it change as expected/required depending on the current active > .direnvrc? > > What happens if you eval (getenv 'psql) while in buffer governed by > direnv, or alternatively > > m-x getenv > psql > > If you `m-x shell`, does normal direnv work as expected in the created shell? > Yes, also works in vterm > > > I've got to try this! > > > > > > Cheers > > > > > > > Please tell me how that works for you > > Gotta get guix rolling again. Hope to do this RSN. > > Cheers, > > ~Malcolm > > > > > Thanks > > > > - A > > > > > > > > > > > > > > > >Where cdpp-manifest.scm contains the following: > > > > > > > >(specifications->manifest > > > >'("python" > > > > "python-pandas" > > > > "python-numpy" > > > > "python-flask" > > > > "python-graphene" > > > > "postgresql" > > > > "jupyter")) > > > > > > > >I am able to use sql-mode and run queries against the database, in order > > > >to achieve that I am using the following .dir-locals.el > > > > > > > >;;; Directory Local Variables > > > >;;; For more information see (info "(emacs) Directory Variables") > > > > > > > > > > > >((nil . > > > > ((projectile-project-test-cmd . "pytest --color=no --failed-first > > > >--maxfail=5"))) > > > >(python-mode . > > > > ((python-shell-buffer-name . "Python > > > >[CDPP-Inspecciones]"))) > > > > > > > >(org-mode . ( > > > > (indent-tabs-mode . nil) > > > > (org-src-preserve-indentation . t) > > > > (org-footnote-auto-adjust . t) > > > > (org-footnote-auto-label . t) > > > > (ispell-local-dictionary . "spanish") > > > > (org-export-allow-bind-keywords .
Re: ob-sql is not finding psql when using direnv+guix
Dear Malcom On Mon, May 10, 2021, at 13:14, Cook, Malcolm wrote: > >I am using Guix with direnv. > > What is your shell? > My shell is bash, originally I was using zsh and I thought that was the problem, so I switched to bash and still not working. > How/When do you "hook direnv into your shell" (https://direnv.net/)? > In the .profile file, at login. > > In an specific folder I am installing and using psql and postgresql using > > direnv+guix as follows: > >use guix --manifest=cdpp-manifest.scm > > > >export PGUSER=food_user > >export PGPASSWORD=some_password > >export PGDATABASE=food > > > >layout postgres > > When are you doing this? > > a) in the "specific folder"'s .envrc file? > b) in an org-mode shell block that you execute prior to the sql block? > c) ?? > > Option (a) > You seem to be following [Per\-project > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgres/) > but with guix instead of nix. Nice. > Yep, great post. direnv + guix change the way I develop software, do data science and write lectures and papers. > If you enter the directory and then call emacs, earthing should just > work, no changes neede. > It works for almost everything (sql-buffers, python buffers, etc), except for org-babel sql blocks. I am using EXWM, so emacs is always on. > If you want to tell emacs to adopt the environment established by a > .direnv, you probably want [direnv integration for > emacs\.](https://github.com/wbolster/emacs-direnv) > emacs-direnv was my first choice, but then I changed to envrc (https://github.com/purcell/envrc) . In both I got the error. > I've got to try this! > > Cheers > Please tell me how that works for you Thanks - A > > > > > >Where cdpp-manifest.scm contains the following: > > > >(specifications->manifest > >'("python" > > "python-pandas" > > "python-numpy" > > "python-flask" > > "python-graphene" > > "postgresql" > > "jupyter")) > > > >I am able to use sql-mode and run queries against the database, in order to > >achieve that I am using the following .dir-locals.el > > > >;;; Directory Local Variables > >;;; For more information see (info "(emacs) Directory Variables") > > > > > >((nil . > > ((projectile-project-test-cmd . "pytest --color=no --failed-first > >--maxfail=5"))) > >(python-mode . > > ((python-shell-buffer-name . "Python [CDPP-Inspecciones]"))) > > > >(org-mode . ( > > (indent-tabs-mode . nil) > > (org-src-preserve-indentation . t) > > (org-footnote-auto-adjust . t) > > (org-footnote-auto-label . t) > > (ispell-local-dictionary . "spanish") > > (org-export-allow-bind-keywords . t) > > (org-footnote-define-inline . nil) > > (org-footnote-section . "Footnotes"))) > > > >(sql-mode . ((sql-connection-alist . ((mydb > > (sql-product 'postgres) > > (sql-database "mydb") > > (sql-user "db_user") > > (sql-server (expand-file-name > >".direnv/postgres")) > > (sql-port 5432) > > ) > > ) > > > >But If I try to use an sql org-babel block > > > >#+begin_src sql > >select 1; > >#+end_src > > > >(I am setting the connection variables in a PROPERTY) > > > >I get the error: `psql is not found` > > > > > >I was reading about the variable sql-postgres-program, so if I set the > >following in dir-locals.el > > > >(sql-postgres-program . > >"/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy9x0-profile/bin/psql") > > > >It works (note that psql ONLY lives inside the profile defined by > >direnv+guix), but I don't like the idea of hardcode the path. > > > >Is there a better way? > > > >Ideally I will expect that the org block will read it from the environment, > >but is not working. > > > >Thanks in advance > > >
ob-sql is not finding psql when using direnv+guix
Hi I am using Guix with direnv. In an specific folder I am installing and using psql and postgresql using direnv+guix as follows: use guix --manifest=cdpp-manifest.scm export PGUSER=food_user export PGPASSWORD=some_password export PGDATABASE=food layout postgres Where cdpp-manifest.scm contains the following: (specifications->manifest '("python" "python-pandas" "python-numpy" "python-flask" "python-graphene" "postgresql" "jupyter")) I am able to use sql-mode and run queries against the database, in order to achieve that I am using the following .dir-locals.el ;;; Directory Local Variables ;;; For more information see (info "(emacs) Directory Variables") ((nil . ((projectile-project-test-cmd . "pytest --color=no --failed-first --maxfail=5"))) (python-mode . ((python-shell-buffer-name . "Python [CDPP-Inspecciones]"))) (org-mode . ( (indent-tabs-mode . nil) (org-src-preserve-indentation . t) (org-footnote-auto-adjust . t) (org-footnote-auto-label . t) (ispell-local-dictionary . "spanish") (org-export-allow-bind-keywords . t) (org-footnote-define-inline . nil) (org-footnote-section . "Footnotes"))) (sql-mode . ((sql-connection-alist . ((mydb (sql-product 'postgres) (sql-database "mydb") (sql-user "db_user") (sql-server (expand-file-name ".direnv/postgres")) (sql-port 5432) ) ) But If I try to use an sql org-babel block #+begin_src sql select 1; #+end_src (I am setting the connection variables in a PROPERTY) I get the error: `psql is not found` I was reading about the variable sql-postgres-program, so if I set the following in dir-locals.el (sql-postgres-program . "/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy9x0-profile/bin/psql") It works (note that psql ONLY lives inside the profile defined by direnv+guix), but I don't like the idea of hardcode the path. Is there a better way? Ideally I will expect that the org block will read it from the environment, but is not working. Thanks in advance