From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oKooN/tTWWEhXwEAgWs5BA (envelope-from ) for ; Sun, 03 Oct 2021 08:55:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id GBLuMvtTWWGYIAAA1q6Kng (envelope-from ) for ; Sun, 03 Oct 2021 06:55:55 +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 82B5E36B77 for ; Sun, 3 Oct 2021 08:55:55 +0200 (CEST) Received: from localhost ([::1]:59872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWvPe-0003Qb-Lb for larch@yhetil.org; Sun, 03 Oct 2021 02:55:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWvNh-0002SD-9s for emacs-orgmode@gnu.org; Sun, 03 Oct 2021 02:53:53 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:42542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWvNe-0005mY-3v for emacs-orgmode@gnu.org; Sun, 03 Oct 2021 02:53:51 -0400 Received: by mail-pl1-x62a.google.com with SMTP id l6so8994620plh.9 for ; Sat, 02 Oct 2021 23:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=YCxqAo/XaxR0oTZ4HQ5oeFNR+sSkoQGRLRahAQzU5q0=; b=aPDibJhqBGlHG2j5H1f+OJjQE5kUas2+FPwx/3x6gSTMdHnerkFJUNmHC7/b0UlaSf lUR8ETmqJc+UFSWICqVM08aVjCWjDkisacsOJd835t0F187sFBP03GVu1DGR/HoohrEX cPZpOVpLgygOYmOq6IOMS0dypzQJ0f77jRtrX1QgGiBGr4vm89DRm+RTFnumD3QR7QTJ 66NtGIgxVL5ZwXrxkH80LxyvgYD/TqhvQSymj5awhmPdY1NbnTEI0GpStE8FiOlHWdsh oZP19Tky82nlzqWhr8I/xVEdc7cdEjgDZhA0DMT/1INjJroem3VXkDEhScGRJks+xVOb ZQfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=YCxqAo/XaxR0oTZ4HQ5oeFNR+sSkoQGRLRahAQzU5q0=; b=PCX/RRKVEYoZIqAtzLcb3OvwdAYr3VryJOcnk/v4TgrHlkborPRAtYd6ScDL+bTXsJ 7nbYPKYl768Fqhp00KmdqqXFS0Din6sZ64Y21LeMAaBcUrERUpoc+JmlFp+aqjRwLsp2 N/L4LVR4TcfuswTG6ylyXJXw6QSe+4gkX5+tmlIsRR4u0FGGVLLre5HzPqPoa/Zdmjn6 zaeDex9/xzNCnJer4KhI/CqhcqhP5Bit5xzSaOf58XvJ/cwLvwGJIaOPazMz60xvDRfh 8c1IHJxmZqG787+jBR0vTZc2xhQPmC/RVsmxy+MihrYEVwsZ7jYEIeuJFwLcxXwj6FJQ 5fXQ== X-Gm-Message-State: AOAM530kAhP2ME2syEMazuIvKlgL8h6rWNTtUy83LHVSk02Qd9ol2Ccm mtX5U0rEpNdvCeq9pl7q9pL5DGLjBGSxT8DQ X-Google-Smtp-Source: ABdhPJyJFnmZYS0/8sO1HgYFkbCfulcT57Nn3ptMWJn0LQuhSbXxMVgTZ5cKJyEBAM7UFUhwpgt0+g== X-Received: by 2002:a17:90a:7d0a:: with SMTP id g10mr29916134pjl.73.1633244028515; Sat, 02 Oct 2021 23:53:48 -0700 (PDT) Received: from localhost ([210.3.160.226]) by smtp.gmail.com with ESMTPSA id r130sm2992954pfc.89.2021.10.02.23.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 23:53:47 -0700 (PDT) From: Ihor Radchenko To: Loris Bennett Subject: Re: Changing the environment before calling source block? In-Reply-To: <87ft0wea3q.fsf@hornfels.zedat.fu-berlin.de> References: <87ft0wea3q.fsf@hornfels.zedat.fu-berlin.de> Date: Sun, 03 Oct 2021 14:55:06 +0800 Message-ID: <87k0iu7g39.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=yantar92@gmail.com; helo=mail-pl1-x62a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, 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: , Cc: Org Mode Mailing List 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=1633244155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=YCxqAo/XaxR0oTZ4HQ5oeFNR+sSkoQGRLRahAQzU5q0=; b=KXf4Qmg9T2Q5aNfZ8EqSjSsWGwKRuIloFbUSKR20urr/A35/MaMtEoFbdWxtc0IgClnf6/ 9mLLZCCC0hFM45PGoQEGmugztRyyI/TLuVDQz9c1GKeJElpnYoQBfXtF5mbX2isDhgW6Ny mubhLFfEbOhh3iXs4GMzx5wY9k77r4c3aUo4K8hY0MjF7ul/Mw8B+AgrRmKCtc/yWGu4nb 6auVVnAfUBoOJo42Y/ISlfrHGmUnW2Kv9AF+0BDePJweITBmeYMLFrA98CA1vO69Y4k9/r 0YerIk4fQNLZhAan6Pp4j+SeNkQs9bCyrytRSIHxNm3M2d9LaDO+x3DMidGRiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633244155; a=rsa-sha256; cv=none; b=A3L3nnUdYQ3hoiVIbig2lzbgfFLyFJM8T1UursOkSTFCnokYCPr1z/tBTdAGBEf2dMnyDV wNgQjqRjwI/1wKoQQBrMfJbFvboDx1J0BRi0Pcngive2HP/jIRekTGkbrvlzU1aPYdyMQF hsePiRsfa3yi/+8pwKSX9DqAoVcBOQZMj/rYoyG15IN+jXUyy4BWulerWbWttslf7BlitP IPJwudu/yGKpZbNe+rMLk9U5X0SlGLzLa8wzNTfhq+50ErqbyEShkdsAmO0aPBZOVLWcAa nsorwRUlZK8RexdsHJOP8lAXzXfv62EsgfIBLJlzDWJ4gpNy4iP6SVzCX0v5eQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aPDibJhq; 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: -2.51 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aPDibJhq; 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: 82B5E36B77 X-Spam-Score: -2.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: C10jNy4Q0mcn "Loris Bennett" writes: > Hi, > > I have multiple versions of each of various languages such as Python > or R. On the command line I can select a version using the 'module'[1] > mechanism provided by Lmod[2]: > > My question is: How do I change the environment, ideally call 'module > load ...' but potentially just set environment variables, before calling > a source block? It depends on source block language. For Python, there is :python header arg where you can specify python command to be used. I am not sure about R More generally, you can advice org-babel-execute-src-block and wrap it into something like with-environment-variables macro (available in newest Emacs). Or you can write a bash source block, set envitonment there as usual, and invoke your Python/R script using noweb. Hope it helps. Best, Ihor