From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SA60BOtenWCAbwEAgWs5BA (envelope-from ) for ; Thu, 13 May 2021 19:16:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id wDBGAOtenWB7FgAAbx9fmQ (envelope-from ) for ; Thu, 13 May 2021 17:16:27 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6406E121D6 for ; Thu, 13 May 2021 19:16:24 +0200 (CEST) Received: from localhost ([::1]:43244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhEwg-0000Zt-AW for larch@yhetil.org; Thu, 13 May 2021 13:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhEt0-0005pG-QB for emacs-orgmode@gnu.org; Thu, 13 May 2021 13:12:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:56177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhEss-0002qS-F6 for emacs-orgmode@gnu.org; Thu, 13 May 2021 13:12:34 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C0E975C00B2 for ; Thu, 13 May 2021 13:12:23 -0400 (EDT) Received: from imap11 ([10.202.2.61]) by compute6.internal (MEProxy); Thu, 13 May 2021 13:12:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unanue.mx; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type:content-transfer-encoding; s=fm2; bh=CufyO oKqmn+/1a0MSKEjM5g/C070EU00/rPDs4CzRiQ=; b=MtSr+29L9/q7uUvTPy+S3 qMk6kWrqhnLeQjONycB4TfiI2FJZeWK73EJnZhFI4zjiQuwWZRW2qXj2U+a1yTAz hOto9tefr6u6H7ksbBZDtZ6WydIqsj9T7Y3Y+5XTwZC3dpkktLhyqiCE4ijTLthU 1jS+S/C135Weph4vCTwuhJ5XpEhKRYoJADqDuz++8184TilmnKjTaXIie+Z9FuKY yFHa/HkyjfiFUwJchHFSrkOS5PGboX75CMS2Bnih/uUW5fw61qzoWb+L3XQnsItW /wrm7uq2akd4lFCeQdVnPnoKNIeZAbpMxFq3Zg4WIXixXm8OkDa60+fLgtdtifuO Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=CufyOoKqmn+/1a0MSKEjM5g/C070EU00/rPDs4CzR iQ=; b=cgFPdt/nlbiHjzkAb3R+sg11t8QNcEiAlusLH6H1do+oqZxBUvPMtJQqG BQebge080LgPxA/cnTj2JCk1Rn+bFWsrTmpg4vbxDSrotP4xUhaprGgCvm07ARdy dvCSswAUGu0yfEwDR4Rvkp/Yymj/bY7z5Ex3gwWvH22R4FcbMqPW5natcgkGFxPt +1No40JlNEa+D+mF40ghI86c8tfO5M+xWLfZ7Sg6kXZOJ1J2xRAhv+noOAmjesF8 Qu0aKlRWprHsVUkQWluYfZ7YPRzI5dRv5u2HslaGsk7KGr46I9s1QDpn6G8rdDQK yPrdo+H9BSdYL0yYK3iEnftqTzh1Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehgedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgse htqhertderreejnecuhfhrohhmpedfteguohhlfhhoucffvgcufghnrghnuhgvfdcuoegr ugholhhfohdoohhrghesuhhnrghnuhgvrdhmgieqnecuggftrfgrthhtvghrnhephfdtge evieeggeffuefhjeetieeludejleelgfdtjeevtdekgeehgfeiheduvdeunecuffhomhgr ihhnpeifohhrkhhinhhgrdhhohifpdguihhrvghnvhdrnhgvthdpthhhvghshhgrrhhpsh druhhspdhgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpegrugholhhfohdoohhrghesuhhnrghnuhgvrdhmgi X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3783A2401A8; Thu, 13 May 2021 13:12:23 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-Id: <99230428-5576-4f08-8312-935967822eb8@www.fastmail.com> In-Reply-To: References: <3d3611c4-17a6-4d55-875b-f566c28d297b@www.fastmail.com> Date: Thu, 13 May 2021 12:12:03 -0500 From: "Adolfo De Unanue" To: emacs-orgmode@gnu.org Subject: =?UTF-8?Q?org-babel_not_finding_executables_when_using_direnv_[Was:_Re:_?= =?UTF-8?Q?ob-sql_is_not_finding_psql_when_using_direnv+guix]?= Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=66.111.4.29; envelope-from=adolfo+org@unanue.mx; helo=out5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620926186; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=CufyOoKqmn+/1a0MSKEjM5g/C070EU00/rPDs4CzRiQ=; b=AQzufH3VbSLqFBTgkJoPtfMrYyybRM0MRIeSOEf8ymfQHDKfHArV74VIDEV1VD6iIz7d7O 92fnoHkRWiPr6KOWjg/R3HrJ0hDgXvLLUc1TAvfFB/8H/Ss7yqVoELl49qOch8WSFqHW+2 te318pNKLoaRFd4gsDnLktTmzEJao1pybOF84bB5mqPeFKi/Qha8cjWtJMj07o8nU5vcwt Jdvj3o9mw+IMHixV7Lg+VBe7sNHvYozSNYLm3fHuAvdN1o6RGBCbuUY1q+2OR9LJFdsLbr fSXT7SJsGbasRMueKpf1RVWQce4sffr4VC183n1KhjGl27GHmRjLRl+At89SaQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620926186; a=rsa-sha256; cv=none; b=Vhh4JdRIXLgmFZRG42QX2H/dGhuxCim9gXBlizH9bth+6Gx7VUaXFkFLhQXmIeFXmCc4DQ CzcOQsDB1HjFmgiR0vKthtvS9/RaadH1yFdDTG3Jen/gKoW5sV2QF8xQ9SXa3RP4gYXDDY aswwswA2rn9EiubGne7myBa3wMJOw4rbgL9BQS+H6x+VavIXD755fYRzchZH4ZZBkA9RaW wN3pBsSg8vW93uavs357vdAH/da7T5K4Q0LmkZgU4QX3fdj7pd9XZedjjoNe83NMUc9Z1t cnSdMA3V3+To2G2/OavVE8bmmsq9334hjtCmbDiaG3grXt60nNTqi+YOGZ38zw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=unanue.mx header.s=fm2 header.b=MtSr+29L; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="cgFPdt/n"; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.44 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=unanue.mx header.s=fm2 header.b=MtSr+29L; dkim=pass header.d=messagingengine.com header.s=fm2 header.b="cgFPdt/n"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 6406E121D6 X-Spam-Score: -0.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: J8xi/yybjSKW On Wed, May 12, 2021, at 08:49, Cook, Malcolm wrote: > > > >I am using Guix with direnv. > > >=20 > > > What is your shell? > > >=20 > >=20 > > 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. > >=20 > > > How/When do you "hook direnv into your shell" (https://direnv.net/= )? > > >=20 > >=20 > > In the .profile file, at login. > >=20 > > > > In an specific folder I am installing and using psql and postgre= sql using direnv+guix as follows: > > > >use guix --manifest=3Dcdpp-manifest.scm > > > > > > > >export PGUSER=3Dfood_user > > > >export PGPASSWORD=3Dsome_password > > > >export PGDATABASE=3Dfood > > > > > > > >layout postgres > > >=20 > > > When are you doing this? > > >=20 > > > a) in the "specific folder"'s .envrc file? > > > b) in an org-mode shell block that you execute prior to the sql bl= ock? > > > c) ?? > >=20 > > Option (a) > >=20 > >=20 > > > You seem to be following [Per\-project=20 > > > Postgres](https://jamey.thesharps.us/2019/05/29/per-project-postgr= es/)=20 > > > but with guix instead of nix. Nice. > > >=20 > >=20 > > Yep, great post. direnv + guix change the way I develop software, do= data science and write lectures and papers. > >=20 > > > If you enter the directory and then call emacs, earthing should ju= st=20 > > > work, no changes neede. > > >=20 > >=20 > > It works for almost everything (sql-buffers, python buffers, etc), e= xcept for org-babel sql blocks. > >=20 > > I am using EXWM, so emacs is always on. > >=20 > >=20 > > > If you want to tell emacs to adopt the environment established by = a=20 > > > .direnv, you probably want [direnv integration for=20 > > > emacs\.](https://github.com/wbolster/emacs-direnv) > > >=20 > >=20 > > emacs-direnv was my first choice, but then I changed to envrc (https= ://github.com/purcell/envrc) . In both I got the error. > >=20 >=20 > I see. Envrc looks superior. Good to know. >=20 > You've covered all my bases. Shooting in the dark, I would=20 > confirm/check the following: >=20 I have news: It fails for python too. Using the same files as before and this block: #+begin_src python=20 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.=20 But if I am in shell, or in a python buffer or in a inferior-python proc= ess Emacs is finding all the libraries and executables. So, I am assumming that the problem lies in how org-babel searchs the pa= th ... Answers to your questions below: > How do you know that envrc is working otherwise? >=20 > When you switch to a direnv controlled buffer do you get any=20 > informative diagnostics in *Messages*? >=20 Yes > Do you get any more if you first `(setq envrc-debug t)`? >=20 Didn't try, Will do later > Is this buffer in the same directory as the .direnvrc file? >=20 Yes > Presumably TRAMP is not in the mix in any way. > No =20 > Variable sql-postgres-program is unchanged from default value of psql >=20 > What is result of >=20 > m-x shell-command > which psql >=20 Is empty when I am not in a direnv controlled directory, the correct pat= h when I enter to those directories. > and does it change as expected/required depending on the current activ= e=20 > .direnvrc? >=20 > What happens if you eval (getenv 'psql) while in buffer governed by=20= > direnv, or alternatively >=20 > m-x getenv > psql >=20 > If you `m-x shell`, does normal direnv work as expected in the created= shell? >=20 Yes, also works in vterm > > > I've got to try this! > > >=20 > > > Cheers > > >=20 > >=20 > > Please tell me how that works for you >=20 > Gotta get guix rolling again. Hope to do this RSN. >=20 > Cheers, >=20 > ~Malcolm >=20 > >=20 > > Thanks > >=20 > > - A > >=20 > >=20 > > > > > > > > > > > >Where cdpp-manifest.scm contains the following: > > > > > > > >(specifications->manifest > > > >'("python" > > > >=C2=A0=C2=A0 "python-pandas" > > > >=C2=A0=C2=A0 "python-numpy" > > > >=C2=A0=C2=A0 "python-flask" > > > >=C2=A0=C2=A0 "python-graphene" > > > >=C2=A0=C2=A0 "postgresql" > > > >=C2=A0=C2=A0 "jupyter")) > > > > > > > >I am able to use sql-mode and run queries against the database, i= n order to achieve that I am using the following .dir-locals.el > > > > > > > >;;; Directory Local Variables > > > >;;; For more information see (info "(emacs) Directory Variables")= > > > > > > > > > > > >((nil . > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((projectile-project-test-cmd . "p= ytest --color=3Dno --failed-first --maxfail=3D5"))) > > > >(python-mode . > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ((python-shell-buffer-name . "Python [CDPP-Inspecciones]"))= ) > > > > > > > >(org-mode . ( > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (indent-tabs-mode . nil) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-src-preserve-indentation . t) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-footnote-auto-adjust . t) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-footnote-auto-label . t) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (ispell-local-dictionary . "spanish") > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-export-allow-bind-keywords . t) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-footnote-define-inline . nil) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (org-footnote-section . "Footnotes"))) > > > > > > > >(sql-mode . ((sql-connection-alist . ((mydb > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (sql-product 'postgres) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2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0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 ) > > > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ))))) > > > > > > > >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 se= t the following in dir-locals.el > > > > > > > >(sql-postgres-program . "/gnu/store/f2v92bkx2vfzmkl14qxj3hlmby4dy= 9x0-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 en= vironment, but is not working.=C2=A0 > > > > > > > >Thanks in advance > > > > > > >=20 > >=20 >=20