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

venv documentation doesn't tell you how to specify a particular version of python #69339

Closed
lac mannequin opened this issue Sep 17, 2015 · 17 comments
Closed

venv documentation doesn't tell you how to specify a particular version of python #69339

lac mannequin opened this issue Sep 17, 2015 · 17 comments
Assignees
Labels
3.7 (EOL) end of life docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@lac
Copy link
Mannequin

lac mannequin commented Sep 17, 2015

BPO 25152
Nosy @brettcannon, @merwok, @bitdancer, @zware, @serhiy-storchaka, @dstufft, @matrixise, @Mariatta
Files
  • issue25152.patch
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2016-10-28.17:26:33.077>
    created_at = <Date 2015-09-17.14:13:32.699>
    labels = ['3.7', 'type-bug', 'library', 'docs']
    title = "venv documentation doesn't tell you how to specify a particular version of python"
    updated_at = <Date 2016-10-28.17:57:44.355>
    user = 'https://bugs.python.org/lac'

    bugs.python.org fields:

    activity = <Date 2016-10-28.17:57:44.355>
    actor = 'zach.ware'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2016-10-28.17:26:33.077>
    closer = 'brett.cannon'
    components = ['Distutils', 'Documentation']
    creation = <Date 2015-09-17.14:13:32.699>
    creator = 'lac'
    dependencies = []
    files = ['45196']
    hgrepos = []
    issue_num = 25152
    keywords = ['patch']
    message_count = 17.0
    messages = ['250891', '250892', '250896', '250897', '250899', '250902', '250906', '250907', '250908', '278380', '279148', '279263', '279266', '279267', '279318', '279619', '279621']
    nosy_count = 11.0
    nosy_names = ['brett.cannon', 'eric.araujo', 'r.david.murray', 'docs@python', 'python-dev', 'zach.ware', 'serhiy.storchaka', 'dstufft', 'matrixise', 'lac', 'Mariatta']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25152'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @lac
    Copy link
    Mannequin Author

    lac mannequin commented Sep 17, 2015

    https://docs.python.org/3/library/venv.html nowhere explicitly states
    how you are supposed to get a venv with a particular python version.
    Users of virtualenv will be looking for a -p option.

    The doc says:

    "Creation of virtual environments is done by executing the pyvenv script:"

    which undoubtably works if you _have_ a pyenv script, but I don't have
    one. It is nowhere stated where I should find one.

    Fortunately, I can also run things as

    some_python_version -m venv myvenv

    This, everybody is able to do. (However, it may not work, see
    bpo-25151 -- but forget that for now.)

    This is something that everybody ought to be able to do.
    Thus I propose either deleting the mention of pyenv, (if it is exactly
    equivalent to running python -m venv) or expanding
    the section, indicating where the script lives, and why you might
    want to run it instead of python -m venv.

    Then, before the line:
    The command, if run with -h, will show the available options:

    add the line:

    The version of python used in the venv is determined at this time.
    If the default version of python is not the one desired, use:

    /path/to/the/python/I/want -m venv myenv instead.

    (Plus, if there is a way to do this with pyenv, then list that
    part here).

    @lac lac mannequin assigned docspython Sep 17, 2015
    @lac lac mannequin added stdlib Python modules in the Lib dir docs Documentation in the Doc dir labels Sep 17, 2015
    @bitdancer
    Copy link
    Member

    Our documentation describes what you get if you install Python using our distribution of python. If you do that, you (by default) get a pyvenv script, and it points to the version of python that you just (last) installed.

    Distributions change this. We can't document what every distribution does.

    That said, I think it would be a good idea to move the description of calling it via 'python -m venv' to be the *first* mention, and *then* describing pyvenv (and noting that it is installed by our installers but a vendor install may do something different, including omit it).

    @lac
    Copy link
    Mannequin Author

    lac mannequin commented Sep 17, 2015

    On thinking things over, I think that venv is, as it stands now,
    only able to work with python3.3 and greater.

    If you want to build a virtualenv for python 2.7, then I think
    venv is not for you.

    I think this needs to be mentioned.

    @bitdancer
    Copy link
    Member

    Not in the python3 docs, it doesn't. The python3 docs are documenting python3. But, this is another reason the -m venv description should be first, to make it clear it is *part* of the python version, not a standalone package that might work with multiple python versions.

    @lac
    Copy link
    Mannequin Author

    lac mannequin commented Sep 17, 2015

    The problem is that people who run into venv will think that it is
    virtualenv made into part of the standard library. Thus they
    will have a great expectation that there will be a -p option to
    specify the python version that they want and that they can get 2.7.

    As Josh Billings (American humourist) wrote:
    "It ain't ignorance causes so much trouble; it's folks knowing so much that ain't so."

    A 'this is not virtualenv' message would be useful.

    @brettcannon
    Copy link
    Member

    Maybe we should consider dropping the generic pyvenv script or at least only install it with a full version suffix like pyvenv3.6 to prevent this kind of confusion (I have this issue all the time with pip and it drives me nuts).

    At the very minimum we should do as David suggests and bump up the python -m suggestion up as the first one.

    @bitdancer
    Copy link
    Member

    I was surprised myself that pyvenv wasn't at least named pyvenv3. I think I've only ever used it once, mostly I use the -m because then I *know* what version of python I'm getting. I'd be in favor of dropping the script except that that would be a backward compatibility break. (Gentoo at least would probably recreate it so that 'pyvenv' continued to work no matter which version of python you had selected as your system default).

    @brettcannon
    Copy link
    Member

    It would break backwards-compatibility, but the fix is to simply switch to python3 -m venv which still gives you the same semantics of using the newest Python 3 installation you have so the work to change is minimal.

    @brettcannon
    Copy link
    Member

    Actually, I like the idea of dropping pyvenv enough that I'm going to create an issue for it and bring it up on python-dev.

    @bitdancer
    Copy link
    Member

    bpo-25154 has deprecated pyvenv in 3.6. The docs, however, still need updating. The updated docs should mention pyvenv only to say that it is deprecated, I think. This change could be applied to 3.5 if we get it in before 3.5 final.

    @bitdancer bitdancer added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Oct 9, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 21, 2016

    New changeset 9feff7ba89b2 by Brett Cannon in branch '3.5':
    Issue bpo-25152: Mention the deprecation of pyvenv
    https://hg.python.org/cpython/rev/9feff7ba89b2

    New changeset 126ff1f3b6cd by Brett Cannon in branch '3.6':
    Merge (issue bpo-25152)
    https://hg.python.org/cpython/rev/126ff1f3b6cd

    New changeset 53bee4ef1d0a by Brett Cannon in branch 'default':
    Merge (issue bpo-25152)
    https://hg.python.org/cpython/rev/53bee4ef1d0a

    @serhiy-storchaka
    Copy link
    Member

    http://buildbot.python.org/all/builders/Docs%203.x/builds/2710/steps/lint/logs/stdio
    python3 tools/rstlint.py -i tools -i venv
    [2] library/venv.rst:27: default role used
    1 problem with severity 2 found.
    Makefile:156: recipe for target 'check' failed

    @Mariatta
    Copy link
    Member

    [2] library/venv.rst:27: default role used
    1 problem with severity 2 found.

    I made a patch to address it. Please review. Thanks :)

    @matrixise
    Copy link
    Member

    we can merge the patch of Mariatta

    @Mariatta
    Copy link
    Member

    Thanks, Stéphane :)
    Perhaps this can be updated into patch review stage?

    @brettcannon
    Copy link
    Member

    It looks like Zachary beat me to fixing this: https://hg.python.org/cpython/rev/5d1934c27137. Thanks for the patch, Mariatta, even if Zachary didn't use it.

    @zware
    Copy link
    Member

    zware commented Oct 28, 2016

    Ah ha, I thought I'd seen it mentioned in an issue somewhere, but I didn't go looking when I noticed my Docs bots were all red. Thanks for the patch anyway, Mariatta!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life docs Documentation in the Doc dir stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    6 participants