Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Fix: Remove .bat when activating venv on windows #91249

Closed
jovinator mannequin opened this issue Mar 22, 2022 · 7 comments
Closed

Documentation Fix: Remove .bat when activating venv on windows #91249

jovinator mannequin opened this issue Mar 22, 2022 · 7 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy OS-windows type-feature A feature request or enhancement

Comments

@jovinator
Copy link
Mannequin

jovinator mannequin commented Mar 22, 2022

BPO 47093
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba, @jovinator

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-03-22.14:57:34.983>
labels = ['easy', '3.9', '3.10', '3.11', 'type-feature', 'OS-windows', 'docs']
title = 'Documentation Fix: Remove .bat when activating venv on windows'
updated_at = <Date 2022-03-25.14:28:00.271>
user = 'https://github.com/jovinator'

bugs.python.org fields:

activity = <Date 2022-03-25.14:28:00.271>
actor = 'jovinator'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'Windows']
creation = <Date 2022-03-22.14:57:34.983>
creator = 'jovinator'
dependencies = []
files = []
hgrepos = []
issue_num = 47093
keywords = ['easy']
message_count = 3.0
messages = ['415783', '415794', '416002']
nosy_count = 7.0
nosy_names = ['paul.moore', 'tim.golden', 'docs@python', 'zach.ware', 'eryksun', 'steve.dower', 'jovinator']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue47093'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

@jovinator
Copy link
Mannequin Author

jovinator mannequin commented Mar 22, 2022

https://docs.python.org/3/tutorial/venv.html

For windows, tutorial-env\Scripts\activate.bat doesn't appear to set up venv successfully.

Instead, tutorial-env\Scripts\activate (without .bat) works. This may confuse new users if this is not rectified.

@jovinator jovinator mannequin added the 3.11 only security fixes label Mar 22, 2022
@jovinator jovinator mannequin assigned docspython Mar 22, 2022
@jovinator jovinator mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement 3.11 only security fixes labels Mar 22, 2022
@jovinator jovinator mannequin assigned docspython Mar 22, 2022
@jovinator jovinator mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Mar 22, 2022
@eryksun
Copy link
Contributor

eryksun commented Mar 22, 2022

Running tutorial-env\Scripts\activate should suffice. The .bat script is for CMD, and the .ps1 script is for PowerShell. The shell should run the right script without having to include the extension.

In Windows 10+, if you use a case-sensitive directory for the virtual environment, note that the script name for PowerShell is "Activate.ps1". PowerShell 7+ checks the directory for any name that case-insensitively matches "activate", but you'll have to run tutorial-env\Scripts\Activate in PowerShell 5.1.

@eryksun eryksun added easy OS-windows 3.9 only security fixes 3.10 only security fixes labels Mar 22, 2022
@jovinator
Copy link
Mannequin Author

jovinator mannequin commented Mar 25, 2022

Do you think it's worth changing it to just activate and adding a footnote mentioning the variations as I've been a dev for a few years now and it stumped me for a minute as I work in a few different envs.

Mainly thinking of making setting up venv's as easy as possible for new comers with one less roadblock on their journey.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@yashlad681
Copy link
Contributor

Hey @jovinator do you mind if I work on this issue?

@Jo-Vin
Copy link

Jo-Vin commented May 5, 2022 via email

@yashlad681
Copy link
Contributor

Hey @JoVinator
Can you have a look at this if what I fixed is needed or fix is not needed at the moment?
#92770

@zooba
Copy link
Member

zooba commented May 13, 2022

Removing the .bat seems like a good move. Windows these days defaults pretty heavily to PowerShell, which will run the batch file, and then discard the changes it makes to the environment. If you omit the extension, the shell will pick the right script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir easy OS-windows type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants