Skip to content

Migrate to Python 3 as default install #18185

Closed

Description

@domenkozar

Activity

  1. added this to the 17.03 milestone on Sep 1, 2016
  2. abbradar commented on Sep 1, 2016

    @abbradar
    Member

    I wanted to create this issue long ago and help with what I can, but hasn't found time ~_^

  3. added
    6.topic: python
    on Sep 1, 2016
  4. FRidh commented on Sep 1, 2016

    @FRidh
    Member

    We should have for each interpreter version a

    • python which is the full version
    • python-stripped which is commonly used in other packages
      and package sets for each.
  5. aneeshusa commented on Sep 1, 2016

    @aneeshusa
    Contributor

    I have used my nixpkgs config to set Python 3 as the default, and have only encountered a few packages requiring Python 2 so far. I can help put in PRs to make sure they use python2 (or python2.tiny / python2.small / python2-stripped ) instead of python3.

    Maybe the python infra should automatically use the smaller version when python/python2 is a build input?

  6. edolstra commented on Sep 1, 2016

    @edolstra
    Member

    Regarding systemd-boot, I started rewriting it in Perl a while back, but it's not entirely finished yet. I can pick that up.

    Other than that, what exactly does it mean to have Python 3 as the "default install" given that NixOS doesn't install Python by default (AFAIK)?

  7. FRidh commented on Sep 1, 2016

    @FRidh
    Member

    pkgs.python = pkgs.python3 instead of pkgs.python = pkgs.python2, and likely pkgs.python3 = pkgs.python35 although we could try 3.6 as well; there aren't going to be many changes from 3.5 to 3.6. This change will impact a lot of packages/services.

  8. domenkozar commented on Sep 2, 2016

    @domenkozar
    MemberAuthor

    @edolstra it means that for graphical stacks we have only python3 in the closure. So Python 3 should be the default interpreter used in applications.

  9. domenkozar commented on Sep 2, 2016

    @domenkozar
    MemberAuthor

    nixos/modules/system/boot/loader/systemd-boot can be easily ported to python3, unless you want to maintain it in perl @edolstra

  10. FRidh commented on Sep 2, 2016

    @FRidh
    Member

    is there a test for systemd-boot?

  11. vcunat commented on Sep 2, 2016

    @vcunat
    Member

    Many packages use python in their build system. I don't know how well python3 is supported for that, generally.

  12. dezgeg commented on Sep 2, 2016

    @dezgeg
    Contributor

    is there a test for systemd-boot?

    There is tests.boot.simpleUefiGummiboot. It's not a release blocker currently though.

  13. FRidh commented on Sep 30, 2016

    @FRidh
    Member

    patchShebangs doesn't patch a #!/usr/bin/python to a Python 3.x path. We could add a symbolic link from python to python3 in the Python 3.x derivations. Any idea what other distributions do?

  14. aneeshusa commented on Sep 30, 2016

    @aneeshusa
    Contributor

    I think it would be best to leave patchShebangs as is, and add a symlink for python in the python3 derivation (and remove it from the python2 derivation to allow simultaneous installations). This adds less complexity, matches how most distributions handle /usr/bin/python, and is something I've been using for a few months without any issues.

  15. added a commit that references this issue on Sep 30, 2016
  16. 14 remaining items

  17. FRidh commented on May 12, 2018

    @FRidh
    Member

    If I understand correctly people are against it because PEP 394 recommends to symlink python to python2 with the rationale being to preserve compatibility with existing python2 script.
    But don't we patch shebang to point to a very specific python interpreter already? Also this document is from 2011: python2 EOL now is only 1.5 years away. What do people expect it will happen after this date?

    PEP 394 says that for the time being the python executable should point to the python2 executable. However, because on Arch python points to python3, it is also advised that scripts that use python in their shebang are made Python 2 and 3 compatible.

    In the case of Nix we're not so much talking about the executables (the python executable in Nixpkgs points to both python2 and python3, with python2 taking precedence), but more about the attribute python, and having that point to the python3 attribute instead of the current python2 attribute.

    I would argue we should do the same as with the shebang but with out attributes: use the python attribute for packages that are both 2 and 3 compatible. Then it becomes easy to change at some point. Many did not like this, because it could break their expressions outside of Nixpkgs. Fair point.

    Last month there was again a discussion on python-dev about PEP 394 and whether python should always point to python2, leading to revision of PEP 394 (python/peps#630). Judging from the discussion I think it is clear now that python should not and will not point to python3.

    Based on that, and the earlier resistance, I am fine with not pointing the python attribute to python3, but instead update all occurrences where python3 can be used. But good luck finding volunteers for doing that.

  18. dotlambda commented on Aug 3, 2018

    @dotlambda
    Member

    Besides using python3 where possible, do we also want to explicitly use python2 instead of python as I did in #44400?

  19. dotlambda commented on Aug 3, 2018

    @dotlambda
    Member

    I think that, in the long run, we might want to remove the python and pythonPackages attributes from all-packages.nix.

  20. grahamc commented on Sep 20, 2018

    @grahamc
    Member

    https://www.python.org/dev/peps/pep-0394/

    for the time being, all distributions should ensure that python, if installed, refers to the same target as python2, unless the user deliberately overrides this or a virtual environment is active.

  21. removed this from the 18.09 milestone on Sep 20, 2018
  22. ryneeverett commented on Mar 6, 2020

    @ryneeverett
    Contributor

    pep394 has been changed since this discussion dropped off. I'm surprised this isn't a 20.03 milestone.

  23. FRidh commented on Mar 7, 2020

    @FRidh
    Member

    That PEP is about the executable and it has been like this for years in Nixpkgs (Python refers to 2 and 3 but if both present 3 takes precedence). It's also a relatively unimportant issue for us.

    Anyway, there are not many Python 2 applications left and we as a project do not have project milestones, but our members may have.

  24. stale commented on Sep 3, 2020

    @stale

    Hello, I'm a bot and I thank you in the name of the community for opening this issue.

    To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

    The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

    If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

    Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

  25. added
    2.status: stale
    on Sep 3, 2020
  26. doronbehar commented on Sep 11, 2020

    @doronbehar
    Contributor

    That's still important.

  27. removed
    2.status: stale
    on Sep 11, 2020
  28. FRidh commented on Sep 11, 2020

    @FRidh
    Member

    Default image uses Python 3 as does nearly every application. There are a couple build-time dependencies for the default image that use Python 2, that are a bit harder to get around. Aside from that there's nothing to be done, so I am closing this.

  29. doronbehar commented on Sep 11, 2020

    @doronbehar
    Contributor

    @FRidh what about renaming the attributes? Making python = python3?

  30. rnhmjoj commented on Sep 11, 2020

    @rnhmjoj
    Contributor

    I think it would be a good idea to write down all remaining python2 packages. For instance, I would start removing old 2.x.nix expressions for packages that have python3 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: python

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions