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

Drop the pyvenv script #69341

Closed
brettcannon opened this issue Sep 17, 2015 · 19 comments
Closed

Drop the pyvenv script #69341

brettcannon opened this issue Sep 17, 2015 · 19 comments
Assignees
Labels
topic-installation type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

BPO 25154
Nosy @warsaw, @brettcannon, @doko42, @pitrou, @scoder, @ericvsmith, @ezio-melotti
Files
  • issue25154.diff
  • issue25154-1.diff
  • 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 2015-10-27.00:11:39.712>
    created_at = <Date 2015-09-17.18:35:21.344>
    labels = ['type-bug', 'expert-installation']
    title = 'Drop the pyvenv script'
    updated_at = <Date 2015-10-27.00:11:39.684>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2015-10-27.00:11:39.684>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2015-10-27.00:11:39.712>
    closer = 'brett.cannon'
    components = ['Installation']
    creation = <Date 2015-09-17.18:35:21.344>
    creator = 'brett.cannon'
    dependencies = []
    files = ['40579', '40861']
    hgrepos = []
    issue_num = 25154
    keywords = ['patch']
    message_count = 18.0
    messages = ['250910', '250912', '250920', '250923', '251021', '251457', '251543', '251605', '253102', '253185', '253263', '253264', '253385', '253386', '253444', '253445', '253457', '253508']
    nosy_count = 10.0
    nosy_names = ['barry', 'brett.cannon', 'doko', 'pitrou', 'scoder', 'eric.smith', 'ezio.melotti', 'python-dev', 'rpointel', 'lac']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25154'
    versions = ['Python 3.5', 'Python 3.6']

    @brettcannon
    Copy link
    Member Author

    I propose that the pyvenv script be deprecated in Python 3.5 and removed in Python 3.8. The reason for this proposal is because it is non-obvious what version of Python a pyvenv command is tied to (heck, it isn't necessarily obvious that it's Python 3). There would be no loss in functionality since the exact same functionality is available through python3 -m venv. This is a backwards-compatibility change, hence the deprecation, but changing various shell scripts and such should be trivial thanks to the -m flag. This would also help promote the use of -m, especially for any projects that rely on being tied to a specific installed interpreter.

    As pointed out in issue bpo-25152, virtualenv provides a -p flag to specify what version of Python should be used to create a virtual environment: https://virtualenv.pypa.io/en/latest/reference.html#virtualenv-command. The pyvenv script and venv package provide no such mechanism since it is included in the stdlib, which makes sense since improvements will be tied to the stdlib of the Python interpreter being used while virtualenv is a standalone project/app.

    Some may argue that worrying about this is unnecessary, but we are already ending up with OSs that come with multiple versions of Python pre-installed, let alone when people install their own versions of Python on top of the system installation. For instance, OS X Yosemite comes with Python 2.6 and 2.7, and then if you install the latest version of Python independently you end up with 3 installations. If they all happened to have a pyvenv script you wouldn't easily know which Python interpreter the pyvenv command was going to use for the virtual environment.

    Since the pyvenv script is just a script, the deprecation will be in the form of a message printed to sys.stderr in the Tools/scripts/pyvenv file mentioning that the deprecation and that people should switch to python3 -m venv instead. The long deprecation cycle is for those who have pyvenv provided by their OS and only upgrade Python every few years, and thus run the risk of missing the deprecation warning. As for the deprecation in Python 3.5.1, that's to get the warning out immediately and to minimize people missing the deprecation prior to the removal.

    @brettcannon brettcannon added topic-installation type-bug An unexpected behavior, bug, or error labels Sep 17, 2015
    @warsaw
    Copy link
    Member

    warsaw commented Sep 17, 2015

    I'm sympathetic, given that in Debian/Ubuntu (and maybe other distros) where we have both Python 3.4 and 3.5, we have to install /usr/bin/pyvenv-3.4 and pyvenv-3.5, and then use symlinks to provide the default version.

    @lac
    Copy link
    Mannequin

    lac mannequin commented Sep 17, 2015

    Due to debian policy decision
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703

    neither pyenv nor python -m venv

    may work for you.

    While things are getting changed, it would be good if people running into
    this problem got a better error message than:

    Error: Command '['<directory>/bin/python3.4', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1

    such as 'Your python may not be configured with ensure-pip'

    @brettcannon
    Copy link
    Member Author

    the ensurepip case is another issue, so if you want you can file a separate issue for it so it doesn't get lost.

    @warsaw
    Copy link
    Member

    warsaw commented Sep 18, 2015

    I have a patch which will at least improve the error message when python3 -m venv fails because python3-venv isn't installed on Debian/Ubuntu. I will work with Doko on this.

    @brettcannon
    Copy link
    Member Author

    python-dev did not seem to object to the idea.

    @brettcannon brettcannon self-assigned this Sep 23, 2015
    @rpointel
    Copy link
    Mannequin

    rpointel mannequin commented Sep 24, 2015

    I would prefer to keep this script with the version referring to the version of python used (pyvenv-3.4, pyvenv-3.5, ...).

    @brettcannon
    Copy link
    Member Author

    Here is a patch that adds a message to stderr about the deprecation.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 16, 2015

    New changeset 6ab285820db2 by Brett Cannon in branch 'default':
    Issue bpo-25154: Deprecate the pyvenv script.
    https://hg.python.org/cpython/rev/6ab285820db2

    @brettcannon
    Copy link
    Member Author

    I have a typo in my commit where I accidentally placed the file argument in str.format() instead of for print() (pointed out on GitHub).

    @brettcannon brettcannon reopened this Oct 19, 2015
    @pitrou
    Copy link
    Member

    pitrou commented Oct 20, 2015

    Did you fix the "exeutable" typo?

    @brettcannon
    Copy link
    Member Author

    Not yet. I will get to it no later than Friday (just a matter of either remembering to quickly fix it when I get home from work, bother setting up SSH keys at work, or simply doing it on Friday when I typically do all of my Python work).

    @scoder
    Copy link
    Contributor

    scoder commented Oct 23, 2015

    May I ask how difficult it is for any of the core developers to fix a known typo in a Python source file?

    @ezio-melotti
    Copy link
    Member

    Fixing a typo is trivial. If the typo affects several version the changeset needs to be merged on all the applicable branches before being pushed.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 26, 2015

    New changeset 7a5f8418b4ab by Brett Cannon in branch 'default':
    Issue bpo-25154: Make the file argument apply to the print function and
    https://hg.python.org/cpython/rev/7a5f8418b4ab

    @brettcannon
    Copy link
    Member Author

    Sorry for the delay on this; fell ill Friday and then had guests all weekend.

    @ericvsmith
    Copy link
    Member

    There's a typo here in 'executable':

    •      '`{} -m venv`'.format(exeutable), file=sys.stderr)
      

    And this could now be:
    print('WARNING: the pyenv script is deprecated in favour of '
    f'{executable} -m venv', file=sys.stderr)

    !

    And since there is no .format() call, you can't accidentally pass it file=.

    @brettcannon brettcannon reopened this Oct 26, 2015
    @brettcannon
    Copy link
    Member Author

    Took Eric's advice in 8828d7847e92 as well as actually tested the results this time. :P

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

    Flimm commented May 6, 2022

    pyvenv has been deprecated in Python 3.6 and removed from Python 3.8.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-installation type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    7 participants