Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Python seems broken on 16.04 LTS

  1. #11
    Join Date
    Aug 2013
    Beans
    4,941

    Re: Python seems broken on 16.04 LTS

    Quote Originally Posted by oldfred View Post
    That is strange

    Code:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID:    Ubuntu
    Description:    Ubuntu 18.04.2 LTS
    Release:    18.04
    Codename:    bionic
    $ which python
    /usr/bin/python
    $ python --version
    Python 2.7.15rc1

  2. #12
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Python seems broken on 16.04 LTS

    Quote Originally Posted by monkeybrain20122 View Post
    Oops too late. Looks like already you have removed python2 and all the "autoremoves" hence broken your system. At this point may be a reinstallation is the least painful way. And why do you login as root?? Again this may be another reason that caused your issue in the first place.
    I haven't removed it, since there were so many dependencies.
    When I
    Code:
    # apt autoremove
    I don't seen any packages to be removed.
    When I
    Code:
    apt -remove python2.7
    I see what I posted.
    That's odd.
    Typically when doing serious administration or trouble shooting I sudo -i to keep from typing sudo over and over again. I exit as soon as I'm finished.
    I've been administering Unix systems for a long time so I'm comfortable as root.
    Last edited by rsteinmetz70112; April 16th, 2019 at 05:48 PM.

  3. #13
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Python seems broken on 16.04 LTS

    Quote Originally Posted by monkeybrain20122 View Post
    Well you haven't explained what your problem is, and why do you have so many versions of python2 and 3???
    I tried to run
    Code:
    # do-release-upgrade
    and the script failed to run see my other thread
    DO NOT try to remove python-2.7 since it is a dependency for many system components and if you remove it your system will break beyond repair.
    I haven't

    FYI 18.04 still uses python-2.7 as default so "upgrading" will not give you python3 as default, but it doesn't really matter though, as long as Ubuntu's team maintains it, the system's default python is just for maintenance, running and installing things.
    That's why I need to fix this. The other versions of python were likely installed as dependencies of other packages. I didn't install them. IN fact the first part of the upgrade runs a script named bionic
    Code:
    #!/usr/bin/python3
    
    from DistUpgrade.DistUpgradeMain import main
    import sys
    
    
    if __name__ == "__main__":
        sys.exit(main())
    that refers to python3 which is linked to python3.5
    Code:
    # ls -ld /usr/bin/python3
    lrwxrwxrwx 1 root root 9 Mar 23  2016 /usr/bin/python3 -> python3.5
    On the other hand you can use different versions of python in your work without tempering with the system's . But update-alternatives is NOT the way to do it because many system components are compiled based on the version that comes with the system, and by changing the default via update alternatives again you break your system (that is probably what caused your issue in the first place)
    The default has not been changed on purpose.

    There are many ways to use different versions of python safely, e.g anaconda or virtualenv. I compiled python3.7 in my $HOME from source and invoke it with a script that sets all the environmental variables (Ubuntu 16.04), --I prefer it to Anaconda because the latter installs other stuffs I don't need, but Anaconda is a lot easier to setup if you are not very experienced, --but I don't remove the system's python3.5, nor do I try to override it with update-alternatives.
    I haven't done any of that.
    Last edited by rsteinmetz70112; April 16th, 2019 at 05:47 PM.

  4. #14
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Python seems broken on 16.04 LTS

    Python will be python2 as link. Not sure if they can change that as then it would break python2 apps.
    But default install will not include python2, just python3. But many apps still use python2, so it gets installed with that app.
    Updated apps will specify python3, so they do not call python.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  5. #15
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Python seems broken on 16.04 LTS

    Quote Originally Posted by oldfred View Post
    Python will be python2 as link. Not sure if they can change that as then it would break python2 apps.
    But default install will not include python2, just python3. But many apps still use python2, so it gets installed with that app.
    Updated apps will specify python3, so they do not call python.
    That's how I understand it except:
    Code:
    # ls -ld python
    lrwxrwxrwx 1 root root 9 Nov 23  2017 python -> python2.7
    # ls -ld python2
    lrwxrwxrwx 1 root root 9 Nov 23  2017 python2 -> python2.7
    # ls -ld python3
    lrwxrwxrwx 1 root root 9 Mar 23  2016 python3 -> python3.5
    My remaining 16.04 LTS computers are all like this.

  6. #16
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Python seems broken on 16.04 LTS

    Be aware that if on Ubuntu 16.04 python > 3.5 (such as 3.6) is installed, gnome-terminal ceases to launch. In Ubuntu 16.04 it depends on python 3.5 and does not run in 3.6. For this reason I now use virtualenv to switch between 2.7, 3.5, 3.6.

  7. #17
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Python seems broken on 16.04 LTS

    Quote Originally Posted by dragonfly41 View Post
    Be aware that if on Ubuntu 16.04 python > 3.5 (such as 3.6) is installed, gnome-terminal ceases to launch. In Ubuntu 16.04 it depends on python 3.5 and does not run in 3.6. For this reason I now use virtualenv to switch between 2.7, 3.5, 3.6.
    As far as I can see python3.6 is not installed on my systems, python 3.5 is.

  8. #18
    Join Date
    Mar 2007
    Beans
    1,325

    Re: Python seems broken on 16.04 LTS

    I've been reinstalling python packages. I finally got lucky. I reinstalled python3-pkg-resources and things seem to be working.

    Code:
     apt install --reinstall python3-pkg-resources
    Now to se if do-release-upgrade runs. Unfortunately it will be some time before I can test it.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •