From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ENZiEXI7xF8wAgAA0tVLHw (envelope-from ) for ; Mon, 30 Nov 2020 00:23:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0O5HDXI7xF9ZMwAAB5/wlQ (envelope-from ) for ; Mon, 30 Nov 2020 00:23:14 +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 969BC94038E for ; Mon, 30 Nov 2020 00:23:13 +0000 (UTC) Received: from localhost ([::1]:57704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjWyG-0007MY-Jc for larch@yhetil.org; Sun, 29 Nov 2020 19:23:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjWy7-0007MP-OD for help-guix@gnu.org; Sun, 29 Nov 2020 19:23:03 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:52818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjWy2-0001DX-3c for help-guix@gnu.org; Sun, 29 Nov 2020 19:23:03 -0500 Received: by mail-wm1-x32c.google.com with SMTP id a6so1973069wmc.2 for ; Sun, 29 Nov 2020 16:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beadling-co-uk.20150623.gappssmtp.com; s=20150623; h=user-agent:from:to:subject:date:message-id:mime-version; bh=RJ1uOlTlyh0d2fr6jQLkDIV2/XVmsaPBsDaz/NRQ7NI=; b=LBCULi01Wie9E60ODrc9RTvPxCIWgi5SpQHESxs3T6ARVpYkkYSs6GMk9ofurSHEXo p6hFd+C5yEOLl5u8q/cMieR8VShLvSPaHbdl5JiDpepjmd5iO1GGADiCn7R/zavJwtWk Q2KG4c4kbHIvdHgjqpLWTDxBVT5/wcEyhambqphxcUKVnVNDRJQPk+cZD0vjGZCECANh 6ap7wvGg8gn4yho6l7k6dWX2yQdWAD41ZV28rbGptTPG6cewm9vIIqdm6LKeVgLlLIvY rLRFBYuMT3ddQFqhHJezaYb5nPe+KtIggFY2vaVYq0l7MjzgZRpMLOB+wXFIybxQnISi ytGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=RJ1uOlTlyh0d2fr6jQLkDIV2/XVmsaPBsDaz/NRQ7NI=; b=ItUBZxV75c89l0m7NO3uNrygKrquzHCDgdxxbEzfTn5CmshJdEhjZQP6yu+pcWkY4y HfBdVYHLXG+iVSQLPLDHQ1Kz8DypjLyEwOLAxFH1xdxmKGoL+6T+uhBEyZ1nmxApLVMc 68B7C4mUtDXiKn6q06hLr+FntHw7w7YMn6ajmxpT1ePg3Qpsq2qiQKvwN8Ato60dFNc4 OueVtfUZa1JQaPaw9Eal8F6TWI6vclD9jUVhhAMr9XRi+EGfSgDGnO4yUQ7AvIecAMWj iHpvTFkzNifQcOEdJT0qd5/XpCQeqcenOnYj68OutHWCok+mEnncKO5ZG2Sy8ZmtjjAL 8W/w== X-Gm-Message-State: AOAM533XzvTaRV/R9QBIPK00oTuH+nsfHUpc9pUDR0esexKhQvB3+7Yx gbRtaiG4EJknk8l0OwtX9lccvpko0o8OPW20DMc= X-Google-Smtp-Source: ABdhPJxRnmOvExtj0qMmSONKh8v/5iEK92fCLyIgQdA6zkFY0h+NYrOk4xs3jMhHShNidGRdZRFJWQ== X-Received: by 2002:a7b:c14f:: with SMTP id z15mr20661307wmi.128.1606695775541; Sun, 29 Nov 2020 16:22:55 -0800 (PST) Received: from phil-XPS-13-9360 (88-111-129-212.dynamic.dsl.as9105.com. [88.111.129.212]) by smtp.gmail.com with ESMTPSA id l8sm24620450wro.46.2020.11.29.16.22.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 29 Nov 2020 16:22:54 -0800 (PST) User-agent: mu4e 1.2.0; emacs 26.3 From: Phil To: help-guix@gnu.org Subject: Avoiding PYTHONPATH - latest? Date: Mon, 30 Nov 2020 00:22:54 +0000 Message-ID: <85360rr8v5.fsf@beadling.co.uk> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: none client-ip=2a00:1450:4864:20::32c; envelope-from=phil@beadling.co.uk; helo=mail-wm1-x32c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.48 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=beadling-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=LBCULi01; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-TUID: 7f6xPWHCSK3a Hi all, I've been having an argument with myself over the last 4 days about if Guix's use of PYTHONPATH is a necessary evil or avoidable on a foreign OS. I've found references to a similar discussion last year, and reference to using a 'fake virtual environment' (does anyone have a reference to the other thread referenced where fake venvs are demonstrated as not working): https://lists.gnu.org/archive/html/guix-devel/2019-06/msg00204.html https://lists.gnu.org/archive/html/guix-devel/2019-06/msg00221.html I had what I think is a similar idea over the weekend and tried it out. Reading the mechanics of venvs as per PEP: https://www.python.org/dev/peps/pep-0405 I decided to see if I added a fake pyvenv.cfg to the python.scm package could allow for us to drop the use of PYTHONPATH completely. Now the results are very preliminary, and I am essentially replacing one hack with another (I'm not creating a venv after-all) - it does seem to work just adding this to the python-3.8's phases: (add-after 'install 'add-pyvenv-cfg (lambda* (#:key outputs #:allow-other-keys) ;; guix-daemon --build-users-group=guixbuild --chroot-directory=/path/to/guix_chroot_extra (let ((out (assoc-ref outputs "out"))) (display (string-append "\nOutput Directory: \n" out "\n")) (install-file "/path/to/guix_chroot_extra/pyvenv.cfg" out) (substitute* (string-append out "/pyvenv.cfg") (("^home.*") (string-append "home = " out "\n")) (("^version.*") (string-append "version = 3.8.2\n")))))) The native-search-paths can then have PYTHONPATH removed (I emulated this by unset'ing it after creating a profile with the modified version of the python package). Starting python and looking at sys.path I could see this worked, both in the cases where lib and bin symlink their counterpart directories in the store, and also work when real lib and bin directories in the profile contain symlinks to the store at the file level. It seems so simple I'm sure it's been tried and found to misbehave, as I hands-up accept it's misuse venv's funtionality (using pyvenv.cfg without setting VIRTUAL_ENV is not defined behaviour). But the current PYTHONPATH implementation immediately runs into problems when you use venvs for development, via the cannonical "pip install -e .". The use of PYTHONPATH means that venvs are not created pure, they inherit Guix's python env which is the exact opposite to what any non-Guix python developer would expect. Ironically when sharing environment setup responsibilities between profiles and venvs like this, inheriting the profile's PYTHONPATH is often useful - but it's still unexpected. The PYTHONPATH, if I've understood correctly, is for user-level tweaks, so hijacking it for system use may cause issues. I was wondering what the current thoughts were on how Guix could workaround using PYTHONPATH to set base system paths? Thanks, Phil.