1

when I run this command :

sudo apt-get autoremove

corresponding output will show :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up dput (0.9.6.4ubuntu3) ...
*** Error compiling '/usr/share/dput/ftp.py'...
  File "/usr/share/dput/ftp.py", line 9
    print "D: FTP-Connection to host: %s" % fqdn
                                        ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/usr/share/dput/helper/dputhelper.py'...
  File "/usr/share/dput/helper/dputhelper.py", line 12
    print "Error: Failed to execute '"+file+"'."
                                     ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/usr/share/dput/http.py'...
  File "/usr/share/dput/http.py", line 55
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

*** Error compiling '/usr/share/dput/https.py'...
  File "/usr/share/dput/https.py", line 3
    exec open("/usr/share/dput/http.py") in d
            ^
SyntaxError: invalid syntax

*** Error compiling '/usr/share/dput/local.py'...
  File "/usr/share/dput/local.py", line 20
    print "D: Uploading with cp to %s" % (incoming)
                                     ^
SyntaxError: invalid syntax

*** Error compiling '/usr/share/dput/rsync.py'...
  File "/usr/share/dput/rsync.py", line 25
    print "D: Uploading with rsync to %s%s:%s" % \
                                             ^
SyntaxError: Missing parentheses in call to 'print'

*** Error compiling '/usr/share/dput/scp.py'...
  File "/usr/share/dput/scp.py", line 29
    if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
                                                          ^
SyntaxError: invalid token

*** Error compiling '/usr/share/dput/sftp.py'...
  File "/usr/share/dput/sftp.py", line 13
    except Exception, e:
                    ^
SyntaxError: invalid syntax

dpkg: error processing package dput (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 dput
E: Sub-process /usr/bin/dpkg returned an error code (1)

I also try to run "Neil" answer from :

Dependency errors after installing and attempting to remove Google Chrome

The output was :

    ashraful@ashraful-Vostro-3458:~$ sudo rm /etc/apt/sources.list
    ashraful@ashraful-Vostro-3458:~$ sudo software-properties-gtk
    /usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
      from gi.repository import GObject, Gdk, Gtk, Gio, GLib
    /usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
      from gi.repository import GObject, Gdk, Gtk, Gio, GLib
    WARNING:root:could not open file '/etc/apt/sources.list'

    WARNING:root:could not open file '/etc/apt/sources.list'

    Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
    ashraful@ashraful-Vostro-3458:~$ sudo apt-get remove --purge google-chrome-stable
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package google-chrome-stable
    ashraful@ashraful-Vostro-3458:~$ sudo apt-get update
    Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
    Hit:2 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
    Reading package lists... Done                     
    ashraful@ashraful-Vostro-3458:~$ sudo apt-get dist-upgrade -y
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages were automatically installed and are no longer required:
      libdb5.3:i386 libgcrypt20:i386 libsystemd0:i386
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Setting up dput (0.9.6.4ubuntu3) ...
    *** Error compiling '/usr/share/dput/ftp.py'...
      File "/usr/share/dput/ftp.py", line 9
        print "D: FTP-Connection to host: %s" % fqdn
                                            ^
    SyntaxError: Missing parentheses in call to 'print'

    *** Error compiling '/usr/share/dput/helper/dputhelper.py'...
      File "/usr/share/dput/helper/dputhelper.py", line 12
        print "Error: Failed to execute '"+file+"'."
                                         ^
    SyntaxError: Missing parentheses in call to 'print'

    *** Error compiling '/usr/share/dput/http.py'...
      File "/usr/share/dput/http.py", line 55
        except ValueError, e:
                         ^
    SyntaxError: invalid syntax

    *** Error compiling '/usr/share/dput/https.py'...
      File "/usr/share/dput/https.py", line 3
        exec open("/usr/share/dput/http.py") in d
                ^
    SyntaxError: invalid syntax

    *** Error compiling '/usr/share/dput/local.py'...
      File "/usr/share/dput/local.py", line 20
        print "D: Uploading with cp to %s" % (incoming)
                                         ^
    SyntaxError: invalid syntax

    *** Error compiling '/usr/share/dput/rsync.py'...
      File "/usr/share/dput/rsync.py", line 25
        print "D: Uploading with rsync to %s%s:%s" % \
                                                 ^
    SyntaxError: Missing parentheses in call to 'print'

    *** Error compiling '/usr/share/dput/scp.py'...
      File "/usr/share/dput/scp.py", line 29
        if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
                                                              ^
    SyntaxError: invalid token

    *** Error compiling '/usr/share/dput/sftp.py'...
      File "/usr/share/dput/sftp.py", line 13
        except Exception, e:
                        ^
    SyntaxError: invalid syntax

    dpkg: error processing package dput (--configure):
     subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
     dput
    E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried cleaning apt using

sudo apt-get clean

I also tried

ashraful@ashraful-Vostro-3458:~$ sudo apt-get -f install
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  1 not fully installed or removed.
  After this operation, 0 B of additional disk space will be used.
  Setting up dput (0.9.6.4ubuntu3) ...
  *** Error compiling '/usr/share/dput/ftp.py'...
    File "/usr/share/dput/ftp.py", line 9
      print "D: FTP-Connection to host: %s" % fqdn
                                          ^
  SyntaxError: Missing parentheses in call to 'print'

  *** Error compiling '/usr/share/dput/helper/dputhelper.py'...
    File "/usr/share/dput/helper/dputhelper.py", line 12
      print "Error: Failed to execute '"+file+"'."
                                       ^
  SyntaxError: Missing parentheses in call to 'print'

  *** Error compiling '/usr/share/dput/http.py'...
    File "/usr/share/dput/http.py", line 55
      except ValueError, e:
                       ^
  SyntaxError: invalid syntax

  *** Error compiling '/usr/share/dput/https.py'...
    File "/usr/share/dput/https.py", line 3
      exec open("/usr/share/dput/http.py") in d
              ^
  SyntaxError: invalid syntax

  *** Error compiling '/usr/share/dput/local.py'...
    File "/usr/share/dput/local.py", line 20
      print "D: Uploading with cp to %s" % (incoming)
                                       ^
  SyntaxError: invalid syntax

  *** Error compiling '/usr/share/dput/rsync.py'...
    File "/usr/share/dput/rsync.py", line 25
      print "D: Uploading with rsync to %s%s:%s" % \
                                               ^
  SyntaxError: Missing parentheses in call to 'print'

  *** Error compiling '/usr/share/dput/scp.py'...
    File "/usr/share/dput/scp.py", line 29
      if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
                                                            ^
  SyntaxError: invalid token

  *** Error compiling '/usr/share/dput/sftp.py'...
    File "/usr/share/dput/sftp.py", line 13
      except Exception, e:
                      ^
  SyntaxError: invalid syntax

  dpkg: error processing package dput (--configure):
   subprocess installed post-installation script returned error exit status 1
  Errors were encountered while processing:
   dput
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  ashraful@ashraful-Vostro-3458:~$

Please Help me. how can I install anything in my Ubuntu 16.04

1 Answers1

2

It appears you must have installed python3 at some point. Python is not backwards compatible, so a script written for python2 will not run with python3.

First do a "python --version" and make sure this is the case. Chances are you'll get something like this that shows python3.x

desktop:~$ python --version
Python 3.5.2

Also make sure you still have python2:

desktop:~$ python2 --version
Python 2.7.12

To fix this I had to make a new symlink for /usr/bin/python, pointing at python2 instead.

sudo ln -sf /usr/bin/python2 /usr/bin/python

Make sure it worked, just do a 'python --version' again and make sure it's 2.x

Robert
  • 91
  • 1
  • 5