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

Created on 2019-12-04 18:24 by brett.cannon, last changed 2020-03-24 01:16 by d3r3kk.

Pull Requests
URL Status Linked Edit
PR 19131 open d3r3kk, 2020-03-24 01:16
Messages (5)
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.
History
Date User Action Args
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