From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mBU9JOWznWAqmwAAgWs5BA (envelope-from ) for ; Fri, 14 May 2021 01:19:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id kCLdH+WznWDzCQAAbx9fmQ (envelope-from ) for ; Thu, 13 May 2021 23:19:01 +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 8DC5F16E49 for ; Fri, 14 May 2021 01:19:00 +0200 (CEST) Received: from localhost ([::1]:54010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhKbb-0002to-EB for larch@yhetil.org; Thu, 13 May 2021 19:18:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhKaY-0002tg-Cg for emacs-orgmode@gnu.org; Thu, 13 May 2021 19:17:54 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:37439) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhKaU-0006eM-OC for emacs-orgmode@gnu.org; Thu, 13 May 2021 19:17:54 -0400 Received: by mail-pj1-x1035.google.com with SMTP id gb21-20020a17090b0615b029015d1a863a91so388998pjb.2 for ; Thu, 13 May 2021 16:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=8Y8kNf8nxM+rv2IOBSPBKhxQw3LKnI1iEmw7yJveWD0=; b=PBkuexqNlhur9/SqD9zzr0ojx3UF2hgrZm5Wlnf4d1qkDFSW88XQkoLhbxxSii4we3 41RrBm+64gu6VyeyewEY/+AllU+RXOWmdyNAAQ3ETPmWLYsPXQqGw0R8eYv0p//UGYIm 4O099qbBOM+w385emhj2YhzbbsGHf8c2ceeT181i2+N1Qv13QfbAOXgQu+k4h63Ln0vd uLvYqOxE+h6Aj3geIawFYrADb6zlG5WswCx16Nhwz3khA/+apSi/bDjjq1xJoOCbZf7n OjxGSoE3e1y2NCRFMod8eOcjBOIGvTl+Ft1rd625RZc6pzZKFxLaciwwW6zzbkxtV7mx onuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=8Y8kNf8nxM+rv2IOBSPBKhxQw3LKnI1iEmw7yJveWD0=; b=DBlL7pI2aqeyqfZV19DC6vwqrnFKRptyfh9WH6XGBdSEvp4OfY2p9oGuqTPQYSObxf PJ090iD27rMblSVMRpWqQp9+HZJx+VTMQqR2Q+gfwN7ifmjY7xR4lidFPRK2Mqh4iuN8 znHj4PzO3Q2Goe+LCnZUUm/LvA3eRd2KHDdURpwCtGNf8oXfy6ZTGQr26/DXb7kgNTl4 fXX2kFf3aUxyNiVHccZ8DEfEF377yK+x6B569A3QYBSECAMoI8XekjL6mJw/bh81DkvS +/MI7YkCYvkM0P5EJPTrJqb3ZSt2SZIV5kvRnv0yNEQC8w5vUtjY7k3iSb3/ItrNKBWk PD0A== X-Gm-Message-State: AOAM531M/fD/sceFBeFjlY6mQIF6d0mBtBLDmoVkB9/0hz/vcGmU4grF cSR/sMvGBc0U5msAZvLFNb1Edgco1u8= X-Google-Smtp-Source: ABdhPJzHluqxkA1RBjzkaXo78Jpow2Qsd6eb8NNWGmyI7y6iA/F6iUce58qYCYRscZTKNdd4fd2GGA== X-Received: by 2002:a17:90a:1382:: with SMTP id i2mr48795117pja.176.1620947868387; Thu, 13 May 2021 16:17:48 -0700 (PDT) Received: from tim-desktop (106-69-120-39.dyn.iinet.net.au. [106.69.120.39]) by smtp.gmail.com with ESMTPSA id i123sm2952717pfc.53.2021.05.13.16.17.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 16:17:47 -0700 (PDT) References: <3d3611c4-17a6-4d55-875b-f566c28d297b@www.fastmail.com> <99230428-5576-4f08-8312-935967822eb8@www.fastmail.com> User-agent: mu4e 1.5.13; emacs 27.2.50 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: org-babel not finding executables when using direnv [Was: Re: ob-sql is not finding psql when using direnv+guix] Date: Fri, 14 May 2021 08:54:50 +1000 In-reply-to: <99230428-5576-4f08-8312-935967822eb8@www.fastmail.com> Message-ID: <87eeeaw7dz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x1035.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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=1620947940; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=8Y8kNf8nxM+rv2IOBSPBKhxQw3LKnI1iEmw7yJveWD0=; b=NHNPW2SdidV9Ch/hIQhpx3mhX2orZSFeb2NgWF3kJvAIgWklX8+oRcCGGTvy1eG9aRnfkd ynG6ocyvEa1iqmcv2HeLv88BI97Wu0DnHcB2jRJw71xbP5BgDQl1ND0uKUWeW7/lp7yGnj sWimjDIFIFZPs3AzKqs4TBgLAHgoX8s78qw48yUJpFSbG6AH/q7ui9ReSYFKD+rQIY4WlO kFe1MOliRKXmnyl4NKyuKNOGLtA0jE5nhflY2GfcSkGqq+OrMFxL7tDeTuHpjeXW4uw9oV /7AOQ0kRmAQ5K5onozAOrP5QrmlbASzT+3SVFiCfjgSNy2pCDnnTRvdpGfVojw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620947940; a=rsa-sha256; cv=none; b=d3BCReqALO4hkLuk1LIv6ZRP5R3TCw3z+sCfXR7dR1IdjTLO/e1Iv7Cl7zvoTtilfjdSuX 9Lp/HblKZ0FjRFy8H3aUTWaVCV2hH+h5lhJlhXb5M8OfIeWGIebP+e+2FvJGe/iuhPeyKi /Dh61AinAf+7WRFVupVFhQmflHIGYiE2o6cB+LGVeh0sHsnFnNKW/hxdfoa1hTfT2R/v4n d23D5rspOidBpvJb4LXBDTm3y/L/3tcoepC20iu9A5WJndfoRF5GEP4Wq9RFOrGZWCbYvK kChWKswVvRq7EC35/jhQQlCjOkNfENmVEokNoWqFgiaaxGKs84v2PJRNpK8a7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=PBkuexqN; dmarc=pass (policy=none) header.from=gmail.com; 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: -3.81 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=PBkuexqN; dmarc=pass (policy=none) header.from=gmail.com; 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: 8DC5F16E49 X-Spam-Score: -3.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: +vG/pqiaNTEk "Adolfo De Unanue" writes: > 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 ... This is very unlikely. If there were issues in this area, we would be seeing many more bug reports. More likely is that the PATH variable doesn't contain what you think it does. First thing I would do is try running the following source block +being_src emacs-lisp (getenv "PATH") +end_src and verify the direnv bin directory is actually in your path. Emacs will inherit the path from the shell running when emacs is started. Changes made in your shell after Emacs has started will have no effect on the PATH variable for emacs. You mentioned at one point your running exwm. If you are not running exwm in a login shell and your not sourcing your ~/.profile prior to starting Emacs/exwm (assuming the direnv settings and path are setup there), then the path variable is not going to have the direnv bin directory. Either you need to ensure the appropriate direnv bin directory is in your path before starting exwm or you need to add a configuration step (e.g. possibly a hook function) which will add the direnv bin directory using setenv. -- Tim Cross