Getting the error message:

E: The package python-samba needs to be reinstalled, but I can't find an archive for it.

Bit of a catch-22, if I can't install, I can't re-install either.

If I run sudo apt-get -f install

Reading package lists... Done 
Building dependency tree        
Reading state information... Done 
The following additional packages will be installed: python-samba 
The following packages will be upgraded: python-samba 1 upgraded, 0 newly installed, 0 to remove and 24 not upgraded. 4 not fully installed or removed. 
Need to get 0 B/1,062 kB of archives. 
After this operation, 0 B of additional disk space will be used. 
Do you want to continue? [Y/n] Y 
(Reading database ... 245710 files and directories currently installed.) 
Preparing to unpack .../python-samba_2%3a4.3.11+dfsg-ubuntu0.16.04.7_amd64.deb ...   
File "/usr/bin/pyclean", line 63
 except (IOError, OSError), e: SyntaxError: invalid syntax dpkg: warning: subprocess old pre-removal script returned error exit status 1 dpkg: trying script from the new package instead ...   
File "/usr/bin/pyclean", line 63
 except (IOError, OSError), e: SyntaxError: invalid syntax dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.7_amd64.deb
(--unpack):  subprocess new pre-removal script returned error exit
status 1 
Traceback (most recent call last):   
File "/usr/bin/pycompile", line 35, in <module> from debpython.version import SUPPORTED, debsorted, vrepr,     
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser' dpkg: error while cleaning up:  
 subprocess installed post-installation script returned error exit status 1   
Errors were encountered while processing:  
  E: Sub-process /usr/bin/dpkg returned an error code (1)
  • I have it python-samba/xenial-updates,xenial-security,now 2:4.3.11+dfsg-0ubuntu0.16.04.7 amd64 [installed,automatic] in mine. What exactly are you doing? – George Udosen Jun 1 '17 at 15:02
  • Run this apt search python-samba and tell me what it outputs! – George Udosen Jun 1 '17 at 15:03
  • Whats the output of sudo apt update ? – Ali Razmdideh Jun 1 '17 at 17:29
  • I ran apt search python-samba and got back: Sorting... Done Full Text Search... Done python-samba/now 2:4.3.11+dfsg-0ubuntu0.16.04.6 amd64 [installed,local] Python bindings for Samba – DovMor Jun 4 '17 at 6:08
  • I ran sudo apt update and got back a typical update (too long to post here) but here are the last few lines: E: The repository 'download.virtualbox.org/virtualbox/debian smp Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. – DovMor Jun 4 '17 at 6:09

My problem came about when I switched the default version of Python from Python2.7 to Python3. When I switched back, the dependency issues were gone.

  • 2
    You have learned a valuable lesson: DO NOT CHANGE THE SYSTEM DEFAULT VERSION OF PYTHON. Elements of your system depend upon it, and changing Python breaks your system. – user535733 Jun 5 '17 at 11:33

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.