This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [venv] Link to instructions to change PowerShell execution policy for venv activation
Type: enhancement Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, d3r3kk, hroncok, miss-islington, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2019-12-04 18:24 by brett.cannon, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19131 merged d3r3kk, 2020-03-24 01:16
PR 19311 merged miss-islington, 2020-04-02 19:00
PR 20383 merged hroncok, 2020-05-25 14:25
PR 20384 merged miss-islington, 2020-05-25 14:54
PR 20385 merged miss-islington, 2020-05-25 14:54
Messages (10)
msg357816 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-12-04 18:24
It would probably be good to add a note in the venv docs about execution policies, why it needs to change for environment activation, and how to do it -- especially now that we sign Activate.ps1 -- so there's less of a chance of people being caught off-guard.
msg357835 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2019-12-04 23:00
And where this has come up as an issue: https://github.com/microsoft/vscode-python/issues/2559.
msg360647 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-01-24 19:44
https:/go.microsoft.com/fwlink/?LinkID=135170 is the link to the MS docs.

The command is:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
msg364863 - (view) Author: Derek Keeler (d3r3kk) * Date: 2020-03-23 17:02
Where would we like to put this information?

My proposal would be to add this in a combination of places:

1. Add a further note near the symlinks on Windows comment in this document: `Doc\using\venv-create.inc`

2. Add a blurb in the Activate.ps1 script itself, so that any user can see it very near where the problem might occur. `Lib\venv\scripts\common\Activate.ps1`

I'd probably put something like the following in there:
---

.. note::
   On Microsoft Windows, it may be required to enable the ``Activate.ps1``
   script by setting the execution policy for the user. You can do this by
   issuing the following Powershell command from a Powershell command window:

   PS C:\Users\user> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

   See `About Execution Policies 
   <https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7>`_
   for more information.

---

(This would exist as a ".Notes" section in the Activate.ps1 script)


What do folks think?
msg364908 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-03-23 23:32
All sound reasonable, Derek.
msg365616 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-04-02 19:00
New changeset 45217af29c7f380089af17beb48a5ea0560bbb9d by Derek Keeler in branch 'master':
bpo-38972: Link to instructions to change PowerShell execution policy (GH-19131)
https://github.com/python/cpython/commit/45217af29c7f380089af17beb48a5ea0560bbb9d
msg365617 - (view) Author: miss-islington (miss-islington) Date: 2020-04-02 19:19
New changeset b7345c24a4d962e2adbafc86e4af77de9e3ef09e by Miss Islington (bot) in branch '3.8':
bpo-38972: Link to instructions to change PowerShell execution policy (GH-19131)
https://github.com/python/cpython/commit/b7345c24a4d962e2adbafc86e4af77de9e3ef09e
msg369882 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-25 14:54
New changeset ef16958d17e83723334a51428f410f726d6492a7 by Miro Hrončok in branch 'master':
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383)
https://github.com/python/cpython/commit/ef16958d17e83723334a51428f410f726d6492a7
msg369888 - (view) Author: miss-islington (miss-islington) Date: 2020-05-25 15:11
New changeset 331b2dfadb2a5dd990145c043d006166e568af7b by Miss Islington (bot) in branch '3.8':
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383)
https://github.com/python/cpython/commit/331b2dfadb2a5dd990145c043d006166e568af7b
msg369889 - (view) Author: miss-islington (miss-islington) Date: 2020-05-25 15:13
New changeset 20b2bf318345170502b9840673594a5a12a40829 by Miss Islington (bot) in branch '3.9':
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383)
https://github.com/python/cpython/commit/20b2bf318345170502b9840673594a5a12a40829
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 83153
2020-05-25 15:13:52miss-islingtonsetmessages: + msg369889
2020-05-25 15:11:46miss-islingtonsetmessages: + msg369888
2020-05-25 14:54:39miss-islingtonsetpull_requests: + pull_request19649
2020-05-25 14:54:30miss-islingtonsetpull_requests: + pull_request19648
2020-05-25 14:54:21vstinnersetnosy: + vstinner
messages: + msg369882
2020-05-25 14:25:44hroncoksetnosy: + hroncok

pull_requests: + pull_request19647
2020-04-02 19:19:46miss-islingtonsetmessages: + msg365617
2020-04-02 19:01:45brett.cannonsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-04-02 19:00:45miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request18674
2020-04-02 19:00:27brett.cannonsetmessages: + msg365616
2020-03-24 01:16:52d3r3kksetkeywords: + patch
stage: patch review
pull_requests: + pull_request18493
2020-03-23 23:32:35brett.cannonsetmessages: + msg364908
2020-03-23 17:02:45d3r3kksetnosy: + d3r3kk
messages: + msg364863
2020-01-24 19:44:34brett.cannonsetmessages: + msg360647
2020-01-06 19:47:36brett.cannonsettitle: Link to instructions to change PowerShell execution policy for venv activation -> [venv] Link to instructions to change PowerShell execution policy for venv activation
2019-12-04 23:00:20brett.cannonsetmessages: + msg357835
2019-12-04 18:24:06brett.cannoncreate