From unknown Tue Jun 17 22:23:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24464: 25.1; python.el virtualenv Resent-From: Pim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Sep 2016 23:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 24464@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147424262515810 (code B ref -1); Sun, 18 Sep 2016 23:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Sep 2016 23:50:25 +0000 Received: from localhost ([127.0.0.1]:34615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bllqr-00046v-9f for submit@debbugs.gnu.org; Sun, 18 Sep 2016 19:50:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blkxD-0002pI-Tg for submit@debbugs.gnu.org; Sun, 18 Sep 2016 18:52:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blkx7-000619-MI for submit@debbugs.gnu.org; Sun, 18 Sep 2016 18:52:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blkx7-000613-J4 for submit@debbugs.gnu.org; Sun, 18 Sep 2016 18:52:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blkx4-000315-Tn for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2016 18:52:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blkx0-00060M-Rn for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2016 18:52:46 -0400 Received: from smtpq6.tb.mail.iss.as9143.net ([212.54.42.169]:44928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blkx0-0005zz-LB for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2016 18:52:42 -0400 Received: from [212.54.42.117] (helo=lsmtp3.tb.mail.iss.as9143.net) by smtpq6.tb.mail.iss.as9143.net with esmtp (Exim 4.82) (envelope-from ) id 1blkwv-0001ei-Hr for bug-gnu-emacs@gnu.org; Mon, 19 Sep 2016 00:52:37 +0200 Received: from dhcp-077-249-110-067.chello.nl ([77.249.110.67] helo=[192.168.192.46]) by lsmtp3.tb.mail.iss.as9143.net with esmtp (Exim 4.82) (envelope-from ) id 1blkwv-00063c-CV for bug-gnu-emacs@gnu.org; Mon, 19 Sep 2016 00:52:37 +0200 From: Pim Message-ID: Date: Mon, 19 Sep 2016 00:52:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.1 cv=HpKLYBnS c=1 sm=0 tr=0 a=IkcTkHD0fZMA:10 a=GW1xBdLrtEIA:10 a=CI2UFPjCppYXUZauG2UA:9 a=Fl4ttXjcg3R_ObbI:21 a=MJA-_g77RWT1pU3p:21 a=QEXdDO2ut3YA:10 xcat=Undefined/Undefined none X-Ziggo-Spam-Status: No X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Mailman-Approved-At: Sun, 18 Sep 2016 19:50:23 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) After setting the variable python-shell-virtualenv-root to the path of a virtual environment and running the run-python command the virtualenv doesn't get used. In GNU Emacs 25.1.1 (x86_64-w64-mingw32) of 2016-09-17 built on KAEL Windowing system distributor 'Microsoft Corp.', version 10.0.14926 Configured using: 'configure --prefix=/tmp/emacs --without-imagemagick 'CFLAGS=-O2 -fomit-frame-pointer -g0'' Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS Important settings: value of $LANG: ENU locale-coding-system: cp1252 Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set You can run the command ‘eval-buffer’ with M-x ev-b RET You can run the command ‘run-python’ with M-x r-py RET Shell native completion is disabled, using fallback Quit Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message dired rfc822 mml mml-sec epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils kmacro compile warnings tramp-cache python tramp-sh tramp tramp-compat auth-source cl-seq eieio eieio-core cl-macs gnus-util mm-util help-fns mail-prsvr password-cache tramp-loaddefs trampver ucs-normalize shell pcomplete format-spec advice json map seq byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv comint ring cl-loaddefs pcase cl-lib ansi-color time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote w32notify dbusbind w32 multi-tty make-network-process emacs) Memory information: ((conses 16 225628 10804) (symbols 56 23171 0) (miscs 48 53 150) (strings 32 27484 7701) (string-bytes 1 879903) (vectors 16 38112) (vector-slots 8 711739 6301) (floats 8 237 36) (intervals 56 257 15) (buffers 976 20)) From unknown Tue Jun 17 22:23:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24464: 25.1; python.el virtualenv Resent-From: Justin Timmons Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Dec 2016 00:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pim Cc: 24464@debbugs.gnu.org Received: via spool by 24464-submit@debbugs.gnu.org id=B24464.148150321022301 (code B ref 24464); Mon, 12 Dec 2016 00:41:01 +0000 Received: (at 24464) by debbugs.gnu.org; 12 Dec 2016 00:40:10 +0000 Received: from localhost ([127.0.0.1]:38561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGEf4-0005nd-1f for submit@debbugs.gnu.org; Sun, 11 Dec 2016 19:40:10 -0500 Received: from mail-qk0-f180.google.com ([209.85.220.180]:36698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGEf2-0005nO-CP for 24464@debbugs.gnu.org; Sun, 11 Dec 2016 19:40:08 -0500 Received: by mail-qk0-f180.google.com with SMTP id n21so69057951qka.3 for <24464@debbugs.gnu.org>; Sun, 11 Dec 2016 16:40:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FABFY1qLtAkeaXoaArutyPj89tLAk2m4YpXEIQQPzvQ=; b=dumPJsZMuQ+x1N1nKPh2XpU4WeJpPQfG6BMdJZe8Nul2qY8d+nt5ltsdY8sQCoSOZ1 Un83VU137hJEjgBKwiP+zqBWD8uPiE99xkpgKi13WHDf/UhXUdsYvYalddCFU+w5nQKE sTCzE3WlDGELTiCuVamD9aU0aDLbOthVialpGtWLw7aKYBybbv770ME7jc8eK5fsK1iz CBYVWG2yUAgKE2lr7xiPBbq0NsLSf2x39OTEyfiG3nLHeqMZQTLzKAIy3ip7VXYQ4Ng7 FvdJO2I3wuubbUvhDfIK96iroZy1uCVt+ouL7jjlvZEyhnrJN2sgdCDs+0YEAOMV5Wcq HnTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=FABFY1qLtAkeaXoaArutyPj89tLAk2m4YpXEIQQPzvQ=; b=JqNm9xkPSDmdCPSpDjPKO7Izj7SsunzNGVplh7rTWvub4nTk2ngpDRUwy1ouG70+6b XXtVCMpDKv5L1cqjtu0kj/pN7vYczZkEwlviWsMydjlQ6AoU8Yo1cTU0N8E1xyc5l+r0 I3m+RMv+asGyuTPFB1EU+B/UxgknrR9J/g4bcVsBaxWUf+1gzGNPOk05uRvIzs63bYHv dgXxuFMb7YzWcQUJ+FlQvrjduTBFFkG+e0LhHltYfZ8q77yrS+iG9KEw1RqvpvJHY8bj 2MXQnmSLqErLUBaiGKiQdLNol+6w3ACZSA/HzL52I9/cK9SSNxP26XLg3c+7KuHL4y1K JDnA== X-Gm-Message-State: AKaTC01NDYYnV/rR3qX9f1il0Mjj4xeVvRuPoD1uwfbKd7jcXIRJpoTpF/c76PTZ6StYOA== X-Received: by 10.55.70.76 with SMTP id t73mr76810557qka.195.1481503202885; Sun, 11 Dec 2016 16:40:02 -0800 (PST) Received: from restitution (c-73-186-209-171.hsd1.ma.comcast.net. [73.186.209.171]) by smtp.gmail.com with ESMTPSA id e24sm25317558qkj.12.2016.12.11.16.40.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Dec 2016 16:40:01 -0800 (PST) From: Justin Timmons References: Date: Sun, 11 Dec 2016 19:39:56 -0500 In-Reply-To: (Pim's message of "Mon, 19 Sep 2016 00:52:36 +0200") Message-ID: <87h96akmjn.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) --=-=-= Content-Type: text/plain It looks like this was caused by an incorrect assumption on the directory structure of the virtualenv directory. According to the virtualenv docs only POSIX systems follow the structure "/path/to/venv/bin/", while windows systems use "/path/to/venv/Scripts" for the location of the binary files, most importantly including the python interpreter (see: https://virtualenv.pypa.io/en/stable/userguide/#windows-notes). This meant that the wrong path was added to `exec-path` and so we were starting the python shell installed on the system, rather than the one bundled inside of the virtualenv. This should be addressed in the attached patch file - it just adds a special case for Windows and prepends that path to the system PATH. I also updated the docs for the `python-shell-calculate-exec-path` function to make it more clear that using the python interpreter bundled in the virtualenv will automatically set the PYTHONPATH to point at the libraries inside of the virtualenv - something that was not immediately obvious to me. Steps to verify that patch is working correctly: 1. (On Windows) 2. Create virtualenv (eg. 'virtualenv ~/venv') 3. Install a library NOT currently installed on the your system inside the virtualenv. ex: ~/venv/Scripts/activate.bat pip install sphinx deactivate.bat 4. Start emacs 5. Set `python-shell-virtualenv-root` to the root directory of your virtualenv (eg. "/home/jtimmons/venv") 6. M-x run-python 7. Make sure that you can import the library installed in the virtualenv in step 3 (eg. 'import sphinx') --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=venv.diff Content-Description: A patch to fix Windows venv usage in python shells diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3701812..86e99f4 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2099,20 +2099,25 @@ remote host, the returned value is intended for (defun python-shell-calculate-exec-path () "Calculate `exec-path'. Prepends `python-shell-exec-path' and adds the binary directory -for virtualenv if `python-shell-virtualenv-root' is set. If -`default-directory' points to a remote host, the returned value -appends `python-shell-remote-exec-path' instead of `exec-path'." +for virtualenv if `python-shell-virtualenv-root' is set - this +will use the python interpreter from inside the virtualenv when +starting the shell. If `default-directory' points to a remote host, +the returned value appends `python-shell-remote-exec-path' instead +of `exec-path'." (let ((new-path (copy-sequence (if (file-remote-p default-directory) python-shell-remote-exec-path - exec-path)))) + exec-path))) + + ;; Windows and POSIX systems use different venv directory structures + (virtualenv-bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin"))) (python-shell--add-to-path-with-priority new-path python-shell-exec-path) (if (not python-shell-virtualenv-root) new-path (python-shell--add-to-path-with-priority new-path - (list (expand-file-name "bin" python-shell-virtualenv-root))) + (list (expand-file-name virtualenv-bin-dir python-shell-virtualenv-root))) new-path))) (defun python-shell-tramp-refresh-remote-path (vec paths) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 11 19:48:17 2016 Received: (at control) by debbugs.gnu.org; 12 Dec 2016 00:48:17 +0000 Received: from localhost ([127.0.0.1]:38567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGEmu-0005zW-Ve for submit@debbugs.gnu.org; Sun, 11 Dec 2016 19:48:17 -0500 Received: from mail-io0-f174.google.com ([209.85.223.174]:33930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGEmt-0005zK-MQ for control@debbugs.gnu.org; Sun, 11 Dec 2016 19:48:16 -0500 Received: by mail-io0-f174.google.com with SMTP id p42so151226560ioo.1 for ; Sun, 11 Dec 2016 16:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version; bh=bWu0wZ3UrdAb+Q3lcz1boyivkRCt+xWVoskUPGbRJsY=; b=LBOGUL22lQvaKAM/uQAyg32SSPyx9R63GKYwD5d6GEqgjc9YsvswOTlrdYYDD4NvUH NFBeaihCjdjvyuCQtAigXHxprf/pjy4FZ+AGlWCYIaGysVSKdDyFCS0BGiram1AYUFLQ L4mtTeWMA32iGlMWvewDygQHEjP6RANYFta6GFHzSUeG3GKVQPrkUz7VKiP0dylpI90A nf1yxKxON9bd7bdFBtpsTkc2Hd+5+9UxHrFYxrBaEOVgz4+awYhIAiwUVLT1NtYdxBK2 c0cQ0w07So7sCTJc0IZITCHZX6sKWZVC2msQyahunXIohq3FOGiFhCdVtXNw/Dk7nNcQ z9kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :mime-version; bh=bWu0wZ3UrdAb+Q3lcz1boyivkRCt+xWVoskUPGbRJsY=; b=UmPLxI+jIdW5TYIAyqIWDIHOTkAEy4L8vRSNzfy1vZxGfF35nROQBpMCDkl6zwG2m9 onRsKK7UA0ODUENEUQMyjNfKJvqLoKHdp1EkBLL2Fv+INTFbtNRugg8YRv+dUTS7TBP4 j3y0Lk/5U8wQMquqsTHbgWexFLcfZhp7gTP2x08rZ7NDbe/ldMwb6pP5oCSJ2tYNvZJN OoF6/jWx37kbquYr0a1IpmbZ931sncmIGM7Y9ql6yYntRFsUh0FcqGG0UcdgZ9OnLBhD K6hYjQWRs/YtNIZ3i1oN+2z1vWTZXASOOqrzhKrqlFAtCP/0ALafcbcEhPTPj185poO+ c0lg== X-Gm-Message-State: AKaTC02EKBt9R0PMTfhDJJZ+s/wEnRGW6tIg7b5Eto3HRwcrwI+g/uVVrfTdwqpZvGgvoA== X-Received: by 10.36.68.146 with SMTP id o140mr15918416ita.33.1481503689912; Sun, 11 Dec 2016 16:48:09 -0800 (PST) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id n206sm3447041itg.1.2016.12.11.16.48.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Dec 2016 16:48:09 -0800 (PST) From: npostavs@users.sourceforge.net To: control@debbugs.gnu.org Subject: control message for bug #24464 Date: Sun, 11 Dec 2016 19:49:10 -0500 Message-ID: <87vauqc6pl.fsf@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) tags 24464 patch quit From unknown Tue Jun 17 22:23:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24464: 25.1; python.el virtualenv Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Oct 2017 01:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Justin Timmons Cc: Pim , 24464@debbugs.gnu.org Received: via spool by 24464-submit@debbugs.gnu.org id=B24464.150820347529002 (code B ref 24464); Tue, 17 Oct 2017 01:25:01 +0000 Received: (at 24464) by debbugs.gnu.org; 17 Oct 2017 01:24:35 +0000 Received: from localhost ([127.0.0.1]:44518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4GcV-0007Xi-6Q for submit@debbugs.gnu.org; Mon, 16 Oct 2017 21:24:35 -0400 Received: from mail-io0-f173.google.com ([209.85.223.173]:50940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e4GcT-0007XV-En for 24464@debbugs.gnu.org; Mon, 16 Oct 2017 21:24:33 -0400 Received: by mail-io0-f173.google.com with SMTP id 97so494205iok.7 for <24464@debbugs.gnu.org>; Mon, 16 Oct 2017 18:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=gsn97GpaqCdAGqYsGMeQE8gt4nSXNGhwtsptXtt5J28=; b=ZssfgS51RxCDNHp/gQ0cfhjgr+QD5H3q5eU5MP1lMZOYEyvYua7lm3oMAkhYQqJtD3 yBG9IDN4km3SCgI1NOseXm+gBr3dbCzudH180qfWJ+1qSaaJKq+QAU17OenRi4Ti3Lv5 QRV4eJRPzCqd8cO0GHwKh2QwnNPi73bOZi58lGXHgjdg2tJ76kA/Tno+41qK8nsuiF2d TXauqhVPPbZffXJ5XDkb0mdU2yIdOuaIDXUdZZSvptemNbNQNKC2NYTf/RHfvoC8irw0 eYcF4oBhJBFFysKBaZzAOVVgNsx2Q9Lvq568+UzrWHIiUHEvatAE1XMS1jOwG36aAPM2 /Low== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=gsn97GpaqCdAGqYsGMeQE8gt4nSXNGhwtsptXtt5J28=; b=BKbQc6gchdmJAQalar8kOMgv9bBhC4bCOOMctZNz7o9KF9AzSfnbi/1HVyKanp6c6x sNDiZbchdF0wlnKljQ3hQ/cvmYCg1qjwPCB8N97AmyGoZ0qDLe+ox9EttVzAtY8G9v5u KXhkV4rBjvHCMW9qQEOlc4hpOCRU4B3QxnE782jxjK8kVnXA5nQTrutaXhAV0cEMt1qh v/3aAosSfH5Z0o7pMHqYQMq3TrltqHCAZooEg42X6Clj5JCLmVc5eFOE7VewTXsuqrq4 r40SrtayOEvmqqpbJUfToKd8NdnWRcbfkEZ1c2Ko1iRV818vfQ5G52SQE3EC+pfds7yc IPkw== X-Gm-Message-State: AMCzsaVSUfX3KeiGMGSL6XEm6xLpY+p0cT4nDcw/Xy24rC2nfKYLXfXt ToQSOLiG5VAl/2dOTtI7JDmyOA== X-Google-Smtp-Source: AOwi7QA++VGxzOLq6tVwWcLND7cympitXPomNexGon3Es0UNshaRlKBGTTwNGEUD/9o5xhZUGesmIA== X-Received: by 10.107.104.12 with SMTP id d12mr13984780ioc.296.1508203467554; Mon, 16 Oct 2017 18:24:27 -0700 (PDT) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id o204sm4165004ioe.63.2017.10.16.18.24.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2017 18:24:26 -0700 (PDT) From: Noam Postavsky References: <87h96akmjn.fsf@gmail.com> Date: Mon, 16 Oct 2017 21:24:24 -0400 In-Reply-To: <87h96akmjn.fsf@gmail.com> (Justin Timmons's message of "Sun, 11 Dec 2016 19:39:56 -0500") Message-ID: <8760beh8hj.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) retitle 24464 python virtualenv support doesn't work on w32 quit Justin Timmons writes: > It looks like this was caused by an incorrect assumption on the > directory structure of the virtualenv directory. According to the > virtualenv docs only POSIX systems follow the structure > "/path/to/venv/bin/", while windows systems use "/path/to/venv/Scripts" > for the location of the binary files, most importantly including the > python interpreter (see: > https://virtualenv.pypa.io/en/stable/userguide/#windows-notes). > > This meant that the wrong path was added to `exec-path` and so we were > starting the python shell installed on the system, rather than the one > bundled inside of the virtualenv. > > This should be addressed in the attached patch file - it just adds a > special case for Windows and prepends that path to the system PATH. > > I also updated the docs for the `python-shell-calculate-exec-path` > function to make it more clear that using the python interpreter bundled > in the virtualenv will automatically set the PYTHONPATH to point at the > libraries inside of the virtualenv - something that was not immediately > obvious to me. > (defun python-shell-calculate-exec-path () > "Calculate `exec-path'. > Prepends `python-shell-exec-path' and adds the binary directory > -for virtualenv if `python-shell-virtualenv-root' is set. If > -`default-directory' points to a remote host, the returned value > -appends `python-shell-remote-exec-path' instead of `exec-path'." > +for virtualenv if `python-shell-virtualenv-root' is set - this > +will use the python interpreter from inside the virtualenv when > +starting the shell. If `default-directory' points to a remote host, > +the returned value appends `python-shell-remote-exec-path' instead > +of `exec-path'." > (let ((new-path (copy-sequence > (if (file-remote-p default-directory) > python-shell-remote-exec-path > - exec-path)))) > + exec-path))) > + > + ;; Windows and POSIX systems use different venv directory structures > + (virtualenv-bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin"))) > (python-shell--add-to-path-with-priority > new-path python-shell-exec-path) > (if (not python-shell-virtualenv-root) > new-path > (python-shell--add-to-path-with-priority > new-path > - (list (expand-file-name "bin" python-shell-virtualenv-root))) > + (list (expand-file-name virtualenv-bin-dir python-shell-virtualenv-root))) > new-path))) Looks good to me. Have you assigned copyright for Emacs? (The patch is small enough to go in regardless, I only ask to know if we should mark it.) From unknown Tue Jun 17 22:23:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24464: 25.1; python.el virtualenv Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Nov 2017 17:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Justin Timmons Cc: Pim , 24464@debbugs.gnu.org Received: via spool by 24464-submit@debbugs.gnu.org id=B24464.150990246624403 (code B ref 24464); Sun, 05 Nov 2017 17:22:01 +0000 Received: (at 24464) by debbugs.gnu.org; 5 Nov 2017 17:21:06 +0000 Received: from localhost ([127.0.0.1]:52519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBOba-0006LS-Gy for submit@debbugs.gnu.org; Sun, 05 Nov 2017 12:21:06 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:45782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBObY-0006Jn-Rr; Sun, 05 Nov 2017 12:21:05 -0500 Received: by mail-io0-f180.google.com with SMTP id i38so13399039iod.2; Sun, 05 Nov 2017 09:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Ww8WikIzpS4yF2mXOB/5WelO7E3HWzWxxR6YBzKx98g=; b=O7x9F6ekswqJWaN7BSqFVVCXWQ2Uw0icTBS3g6GZ+s6hWEbCwyssjtkBngimq5oJz1 GIYtJwm0rxKP0GrgQ3bbOihg3eZMqzUivA1JcZ8r72rlvNfa3zwq/ZcMWUlwwQ+XU0Ah OxMmxyCSbQRRcfWLQ3/zwNscrPo08FBvd+2chJpvyNWU1F2O/EFQzhpAceEmfv84+W3v MCO319ZY5wVjC0Ak70tkWqupZkQxW1QgPfd+zM7d2tv9KopAc0UHnQnVJ2qzUN2kRwoB KUC8xZM+kTN2OVoJt1NlBdxdtNnFjwKk3EqvHfCjHJtkrKNcnqQFtFqmBJZfPl3ldqe4 0WMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Ww8WikIzpS4yF2mXOB/5WelO7E3HWzWxxR6YBzKx98g=; b=paULVL29da5K+s4LyaqSAZB+30l94rcl1UGEVr0lEyvShtf8B44OeDu9TDLJbBOAmR rgamND1Nnvlb3QmdDrJzvqXyM0JAU8/w9NO/x4ceQA1LrGsD75dDqOtYkFofYCd9oXDe xMfKEa4qECBJMk+WPUQeqPdc1fGgSv3czlXBW6NeO5IWOanz8Cs7qKTsLCH6FJTcEPm4 +UgJXAWmVWfCAbQHdmol8TaR3odE9R+HOzfChDK6nvaGptGXOJdwttV5LSe0T2a+lLq7 xNd8OHdVqfP7cTW2nmEYl5Dg5BkpuOFUugp2AP7tiXia0yDZdg4iUykk7oS5WPDWCVz4 g/0A== X-Gm-Message-State: AMCzsaVf/JSsZUBuSDDQEu8b8O1rWoV3rD47fXDHrUM4lqCtKdBmJGzB qIZY1ZzhXOILo7WtjZY28IsElA== X-Google-Smtp-Source: ABhQp+TDVWUR1cxVTIAiEhl90baO2KhYwQDm5lwPTFqbQ9mSL8jFj6sI4yRdrZBojbsjZ7EratfaNQ== X-Received: by 10.107.47.133 with SMTP id v5mr16005917iov.22.1509902459251; Sun, 05 Nov 2017 09:20:59 -0800 (PST) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id e77sm3421156itc.25.2017.11.05.09.20.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Nov 2017 09:20:58 -0800 (PST) From: Noam Postavsky References: <87h96akmjn.fsf@gmail.com> Date: Sun, 05 Nov 2017 12:20:57 -0500 In-Reply-To: <87h96akmjn.fsf@gmail.com> (Justin Timmons's message of "Sun, 11 Dec 2016 19:39:56 -0500") Message-ID: <878tfk7ibq.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) tags 24464 fixed close 24464 26.1 quit Justin Timmons writes: > This should be addressed in the attached patch file - it just adds a > special case for Windows and prepends that path to the system PATH. I've pushed this to emacs-26. [1: 18af404ef3]: 2017-11-05 11:39:06 -0500 Support python virtualenv on w32 (Bug#24464) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=18af404ef33d8efcbb9446945e543251ab33aa3c