1

I can't do anything with apt-get because of python-minimal. I think I may have corrupted my python!

Whenever I want to install, remove, or upgrade using apt-get, it gives me this error:

Errors were encountered while processing:
    python-minimal

I tried searching and tried every solution I found about this issue, now I'm at a point where I want to cleanly uninstall and install a fresh version of python.

These are things I tried so far:

First I had python installed, and every apt-get command resulted in this output:

all these commands:

sudo apt-get autoremove -f
sudo apt-get autoclean # and then install python
sudo apt-get upgrade
sudo apt-get -f install
sudo apt-get download python-minimal; sudo dpkg -i py*deb
sudo apt-get remove python
sudo apt-get autoremove python-minimal
sudo apt-get install --reinstall python-minimal

resulted in this same output:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 162, in 
_run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

then I tried this, this, this, this and this and nothing worked for me.

then I got tired and tried to manually remove python, so I removed python files with rm -rf and now this command:

sudo apt-get upgrade python -f

results in:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

and now when I run sudo apt-get purge python-minimal I get

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 python : Depends: python-minimal (= 2.7.5-5ubuntu3) but it is not 
going to be installed
 python-support : Depends: python-minimal but it is not going to be 
installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or 
specify a solution).

and after running sudo apt-get -f install I get

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libpython-stdlib python
Suggested packages:
  python-doc python-tk
The following packages will be upgraded:
  libpython-stdlib python
2 upgraded, 0 newly installed, 0 to remove and 253 not upgraded.
1 not fully installed or removed.
Need to get 0 B/175 kB of archives.
After this operation, 4,096 B disk space will be freed.
Do you want to continue? [Y/n] Y
Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT:

running this command sudo dpkg --configure -a gives me following output:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal
ganjim
  • 111
  • 1
  • 5

0 Answers0