Error upgrading Ubuntu 16.04 LTS python-minimal package error
up vote
4
down vote
favorite
Everything was going very smooth until today when I decided to upgrade Ubuntu 16.04.3 to 16.04.4
When it was in the last stage of installing the downloaded updates, python-minimal
packaged failed to install with following error:
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I thought re-installing python and appropriate packages would help. But I unfortunately ended with uninstalling all python packages and softwares who were depending on python like gimp, mplayer, kde, kicad, pycharm etc..
Now everytime I try to install python I get below error:
$ sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 1,628 kB/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [340 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [1,261 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Fetched 1,628 kB in 6s (248 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I also can't install any software which requires python.
My current version of ubuntu after unsuccessful upgrade:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Did anyone face similar issue and was able to solve it? Any help would be greatly appreciated.
16.04 apt upgrade python python-2.7
add a comment |
up vote
4
down vote
favorite
Everything was going very smooth until today when I decided to upgrade Ubuntu 16.04.3 to 16.04.4
When it was in the last stage of installing the downloaded updates, python-minimal
packaged failed to install with following error:
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I thought re-installing python and appropriate packages would help. But I unfortunately ended with uninstalling all python packages and softwares who were depending on python like gimp, mplayer, kde, kicad, pycharm etc..
Now everytime I try to install python I get below error:
$ sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 1,628 kB/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [340 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [1,261 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Fetched 1,628 kB in 6s (248 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I also can't install any software which requires python.
My current version of ubuntu after unsuccessful upgrade:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Did anyone face similar issue and was able to solve it? Any help would be greatly appreciated.
16.04 apt upgrade python python-2.7
1
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
You should move your python stuff out the way from/usr/local
. And then retry withsudo apt-get install -f
,sudo dpkg --configure -a
.
– N0rbert
Apr 20 at 21:13
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Everything was going very smooth until today when I decided to upgrade Ubuntu 16.04.3 to 16.04.4
When it was in the last stage of installing the downloaded updates, python-minimal
packaged failed to install with following error:
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I thought re-installing python and appropriate packages would help. But I unfortunately ended with uninstalling all python packages and softwares who were depending on python like gimp, mplayer, kde, kicad, pycharm etc..
Now everytime I try to install python I get below error:
$ sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 1,628 kB/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [340 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [1,261 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Fetched 1,628 kB in 6s (248 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I also can't install any software which requires python.
My current version of ubuntu after unsuccessful upgrade:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Did anyone face similar issue and was able to solve it? Any help would be greatly appreciated.
16.04 apt upgrade python python-2.7
Everything was going very smooth until today when I decided to upgrade Ubuntu 16.04.3 to 16.04.4
When it was in the last stage of installing the downloaded updates, python-minimal
packaged failed to install with following error:
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I thought re-installing python and appropriate packages would help. But I unfortunately ended with uninstalling all python packages and softwares who were depending on python like gimp, mplayer, kde, kicad, pycharm etc..
Now everytime I try to install python I get below error:
$ sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 1,628 kB/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [340 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.3 [1,261 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Fetched 1,628 kB in 6s (248 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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)
I also can't install any software which requires python.
My current version of ubuntu after unsuccessful upgrade:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
Did anyone face similar issue and was able to solve it? Any help would be greatly appreciated.
16.04 apt upgrade python python-2.7
16.04 apt upgrade python python-2.7
asked Apr 20 at 19:28
Saurav Kumar
10.2k134464
10.2k134464
1
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
You should move your python stuff out the way from/usr/local
. And then retry withsudo apt-get install -f
,sudo dpkg --configure -a
.
– N0rbert
Apr 20 at 21:13
add a comment |
1
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
You should move your python stuff out the way from/usr/local
. And then retry withsudo apt-get install -f
,sudo dpkg --configure -a
.
– N0rbert
Apr 20 at 21:13
1
1
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
You should move your python stuff out the way from
/usr/local
. And then retry with sudo apt-get install -f
, sudo dpkg --configure -a
.– N0rbert
Apr 20 at 21:13
You should move your python stuff out the way from
/usr/local
. And then retry with sudo apt-get install -f
, sudo dpkg --configure -a
.– N0rbert
Apr 20 at 21:13
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
After hours of struggling and hundreds time of installing/uninstalling python packages looks like I was able to install python packages including python-minimal
. Let me share my success story.
At the beginning, I was not even able to uninstall python-minimal. Every time it showed the error I mentioned in my question while installing/uninstalling. Even tried
sudo apt-get -f install
but without any gain. Somehow I figured out that it can only be uninstalled with few other packages together. Following commands, I used to completed removepython-minimal
broken and residual packages:
sudo apt-get autoremove libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
This would remove all the python packages and the softwares which depends on python. I know this was extreme but believe me I was not having any choice.
sudo apt-get remove --purge $(sudo dpkg -l | egrep "^(rc|iU)" | awk '{print $2}' | tr 'n' ' ')
To remove rest of residual and borken packages if any.
Note: I copied the list of packages which were removed in this step. I knew that I would need it again!
Next I searched all the places where python2.7 was installed and removed all files and directory of default python. I wished that I had not to delete them manually but was not having any choice:
sudo find / -iname python2.7
/etc/python2.7
/usr/local/bin/python2.7
/usr/local/lib/python2.7
/usr/lib/python2.7
/usr/bin/python2.7.13/lib/python2.7
/usr/bin/python2.7.13/bin/python2.7
/usr/bin/python2.7.13/include/python2.7
/usr/bin/python2.7
/usr/include/x86_64-linux-gnu/python2.7
/usr/include/python2.7
/usr/share/doc/python2.7
/usr/share/binfmts/python2.7
/usr/share/lintian/overrides/python2.7
/proc/sys/fs/binfmt_misc/python2.7
/var/lib/binfmts/python2.7
I had not to delete all the files/directories listed above and deleted only the default version:
sudo rm -rf /etc/python2.7 /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/lib/python2.7
There were other versions of python and were not causing any trouble. I believe the search may vary per user and
whereis python
command can be used to get the path of default python installed.
Next, I installed python with a success:
sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 251742 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
NOTE: This only installed the very necessary and minimal python packages. You may still need to install all other python packages which were uninstalled in 1st step.
Few Extra Notes:
2nd steps deleted 3rd party python packages as well which were installed globally using pip. Unfortunately, I was not having the list and ended up with few troubles which my projects who need them. But that was not a big deal as all my projects were having their own python requirements.txt file. But still I suggest you all to save the python packages in a file before starting the 1st step. Following command can come in handy:
pip freeze > python_pip_packages.txt
Also I had to delete pip files and directories(similar to how I deleted python default files and directories) and re-installed pip:
sudo apt-get install python-pip # installing pip
sudo pip install --upgrade pip # upgrading pip to latest version using pip itself
sudo pip install -r python_pip_packages.txt # re-installing all 3rd party python packages which were removed in 2nd step.
Hope others don't suffer like me :)
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
add a comment |
up vote
1
down vote
For those who keep getting stuck while running commands (where it constantly complains about python or any other package), I went through the same and sorted that problem by removing the information from
/var/lib/dpkg/info/<the package giving you headache>
After that, should allow you to proceed with installations/upgrade/updates
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1026780%2ferror-upgrading-ubuntu-16-04-lts-python-minimal-package-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
After hours of struggling and hundreds time of installing/uninstalling python packages looks like I was able to install python packages including python-minimal
. Let me share my success story.
At the beginning, I was not even able to uninstall python-minimal. Every time it showed the error I mentioned in my question while installing/uninstalling. Even tried
sudo apt-get -f install
but without any gain. Somehow I figured out that it can only be uninstalled with few other packages together. Following commands, I used to completed removepython-minimal
broken and residual packages:
sudo apt-get autoremove libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
This would remove all the python packages and the softwares which depends on python. I know this was extreme but believe me I was not having any choice.
sudo apt-get remove --purge $(sudo dpkg -l | egrep "^(rc|iU)" | awk '{print $2}' | tr 'n' ' ')
To remove rest of residual and borken packages if any.
Note: I copied the list of packages which were removed in this step. I knew that I would need it again!
Next I searched all the places where python2.7 was installed and removed all files and directory of default python. I wished that I had not to delete them manually but was not having any choice:
sudo find / -iname python2.7
/etc/python2.7
/usr/local/bin/python2.7
/usr/local/lib/python2.7
/usr/lib/python2.7
/usr/bin/python2.7.13/lib/python2.7
/usr/bin/python2.7.13/bin/python2.7
/usr/bin/python2.7.13/include/python2.7
/usr/bin/python2.7
/usr/include/x86_64-linux-gnu/python2.7
/usr/include/python2.7
/usr/share/doc/python2.7
/usr/share/binfmts/python2.7
/usr/share/lintian/overrides/python2.7
/proc/sys/fs/binfmt_misc/python2.7
/var/lib/binfmts/python2.7
I had not to delete all the files/directories listed above and deleted only the default version:
sudo rm -rf /etc/python2.7 /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/lib/python2.7
There were other versions of python and were not causing any trouble. I believe the search may vary per user and
whereis python
command can be used to get the path of default python installed.
Next, I installed python with a success:
sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 251742 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
NOTE: This only installed the very necessary and minimal python packages. You may still need to install all other python packages which were uninstalled in 1st step.
Few Extra Notes:
2nd steps deleted 3rd party python packages as well which were installed globally using pip. Unfortunately, I was not having the list and ended up with few troubles which my projects who need them. But that was not a big deal as all my projects were having their own python requirements.txt file. But still I suggest you all to save the python packages in a file before starting the 1st step. Following command can come in handy:
pip freeze > python_pip_packages.txt
Also I had to delete pip files and directories(similar to how I deleted python default files and directories) and re-installed pip:
sudo apt-get install python-pip # installing pip
sudo pip install --upgrade pip # upgrading pip to latest version using pip itself
sudo pip install -r python_pip_packages.txt # re-installing all 3rd party python packages which were removed in 2nd step.
Hope others don't suffer like me :)
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
add a comment |
up vote
4
down vote
accepted
After hours of struggling and hundreds time of installing/uninstalling python packages looks like I was able to install python packages including python-minimal
. Let me share my success story.
At the beginning, I was not even able to uninstall python-minimal. Every time it showed the error I mentioned in my question while installing/uninstalling. Even tried
sudo apt-get -f install
but without any gain. Somehow I figured out that it can only be uninstalled with few other packages together. Following commands, I used to completed removepython-minimal
broken and residual packages:
sudo apt-get autoremove libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
This would remove all the python packages and the softwares which depends on python. I know this was extreme but believe me I was not having any choice.
sudo apt-get remove --purge $(sudo dpkg -l | egrep "^(rc|iU)" | awk '{print $2}' | tr 'n' ' ')
To remove rest of residual and borken packages if any.
Note: I copied the list of packages which were removed in this step. I knew that I would need it again!
Next I searched all the places where python2.7 was installed and removed all files and directory of default python. I wished that I had not to delete them manually but was not having any choice:
sudo find / -iname python2.7
/etc/python2.7
/usr/local/bin/python2.7
/usr/local/lib/python2.7
/usr/lib/python2.7
/usr/bin/python2.7.13/lib/python2.7
/usr/bin/python2.7.13/bin/python2.7
/usr/bin/python2.7.13/include/python2.7
/usr/bin/python2.7
/usr/include/x86_64-linux-gnu/python2.7
/usr/include/python2.7
/usr/share/doc/python2.7
/usr/share/binfmts/python2.7
/usr/share/lintian/overrides/python2.7
/proc/sys/fs/binfmt_misc/python2.7
/var/lib/binfmts/python2.7
I had not to delete all the files/directories listed above and deleted only the default version:
sudo rm -rf /etc/python2.7 /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/lib/python2.7
There were other versions of python and were not causing any trouble. I believe the search may vary per user and
whereis python
command can be used to get the path of default python installed.
Next, I installed python with a success:
sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 251742 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
NOTE: This only installed the very necessary and minimal python packages. You may still need to install all other python packages which were uninstalled in 1st step.
Few Extra Notes:
2nd steps deleted 3rd party python packages as well which were installed globally using pip. Unfortunately, I was not having the list and ended up with few troubles which my projects who need them. But that was not a big deal as all my projects were having their own python requirements.txt file. But still I suggest you all to save the python packages in a file before starting the 1st step. Following command can come in handy:
pip freeze > python_pip_packages.txt
Also I had to delete pip files and directories(similar to how I deleted python default files and directories) and re-installed pip:
sudo apt-get install python-pip # installing pip
sudo pip install --upgrade pip # upgrading pip to latest version using pip itself
sudo pip install -r python_pip_packages.txt # re-installing all 3rd party python packages which were removed in 2nd step.
Hope others don't suffer like me :)
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
After hours of struggling and hundreds time of installing/uninstalling python packages looks like I was able to install python packages including python-minimal
. Let me share my success story.
At the beginning, I was not even able to uninstall python-minimal. Every time it showed the error I mentioned in my question while installing/uninstalling. Even tried
sudo apt-get -f install
but without any gain. Somehow I figured out that it can only be uninstalled with few other packages together. Following commands, I used to completed removepython-minimal
broken and residual packages:
sudo apt-get autoremove libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
This would remove all the python packages and the softwares which depends on python. I know this was extreme but believe me I was not having any choice.
sudo apt-get remove --purge $(sudo dpkg -l | egrep "^(rc|iU)" | awk '{print $2}' | tr 'n' ' ')
To remove rest of residual and borken packages if any.
Note: I copied the list of packages which were removed in this step. I knew that I would need it again!
Next I searched all the places where python2.7 was installed and removed all files and directory of default python. I wished that I had not to delete them manually but was not having any choice:
sudo find / -iname python2.7
/etc/python2.7
/usr/local/bin/python2.7
/usr/local/lib/python2.7
/usr/lib/python2.7
/usr/bin/python2.7.13/lib/python2.7
/usr/bin/python2.7.13/bin/python2.7
/usr/bin/python2.7.13/include/python2.7
/usr/bin/python2.7
/usr/include/x86_64-linux-gnu/python2.7
/usr/include/python2.7
/usr/share/doc/python2.7
/usr/share/binfmts/python2.7
/usr/share/lintian/overrides/python2.7
/proc/sys/fs/binfmt_misc/python2.7
/var/lib/binfmts/python2.7
I had not to delete all the files/directories listed above and deleted only the default version:
sudo rm -rf /etc/python2.7 /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/lib/python2.7
There were other versions of python and were not causing any trouble. I believe the search may vary per user and
whereis python
command can be used to get the path of default python installed.
Next, I installed python with a success:
sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 251742 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
NOTE: This only installed the very necessary and minimal python packages. You may still need to install all other python packages which were uninstalled in 1st step.
Few Extra Notes:
2nd steps deleted 3rd party python packages as well which were installed globally using pip. Unfortunately, I was not having the list and ended up with few troubles which my projects who need them. But that was not a big deal as all my projects were having their own python requirements.txt file. But still I suggest you all to save the python packages in a file before starting the 1st step. Following command can come in handy:
pip freeze > python_pip_packages.txt
Also I had to delete pip files and directories(similar to how I deleted python default files and directories) and re-installed pip:
sudo apt-get install python-pip # installing pip
sudo pip install --upgrade pip # upgrading pip to latest version using pip itself
sudo pip install -r python_pip_packages.txt # re-installing all 3rd party python packages which were removed in 2nd step.
Hope others don't suffer like me :)
After hours of struggling and hundreds time of installing/uninstalling python packages looks like I was able to install python packages including python-minimal
. Let me share my success story.
At the beginning, I was not even able to uninstall python-minimal. Every time it showed the error I mentioned in my question while installing/uninstalling. Even tried
sudo apt-get -f install
but without any gain. Somehow I figured out that it can only be uninstalled with few other packages together. Following commands, I used to completed removepython-minimal
broken and residual packages:
sudo apt-get autoremove libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
This would remove all the python packages and the softwares which depends on python. I know this was extreme but believe me I was not having any choice.
sudo apt-get remove --purge $(sudo dpkg -l | egrep "^(rc|iU)" | awk '{print $2}' | tr 'n' ' ')
To remove rest of residual and borken packages if any.
Note: I copied the list of packages which were removed in this step. I knew that I would need it again!
Next I searched all the places where python2.7 was installed and removed all files and directory of default python. I wished that I had not to delete them manually but was not having any choice:
sudo find / -iname python2.7
/etc/python2.7
/usr/local/bin/python2.7
/usr/local/lib/python2.7
/usr/lib/python2.7
/usr/bin/python2.7.13/lib/python2.7
/usr/bin/python2.7.13/bin/python2.7
/usr/bin/python2.7.13/include/python2.7
/usr/bin/python2.7
/usr/include/x86_64-linux-gnu/python2.7
/usr/include/python2.7
/usr/share/doc/python2.7
/usr/share/binfmts/python2.7
/usr/share/lintian/overrides/python2.7
/proc/sys/fs/binfmt_misc/python2.7
/var/lib/binfmts/python2.7
I had not to delete all the files/directories listed above and deleted only the default version:
sudo rm -rf /etc/python2.7 /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/lib/python2.7
There were other versions of python and were not causing any trouble. I believe the search may vary per user and
whereis python
command can be used to get the path of default python installed.
Next, I installed python with a success:
sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2.7-doc
The following NEW packages will be installed:
libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2.7 python2.7-minimal
0 upgraded, 7 newly installed, 0 to remove and 21 not upgraded.
Need to get 0 B/3,877 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 250996 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.3_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.3) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 251742 files and directories currently installed.)
Preparing to unpack .../python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.3) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.3) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
NOTE: This only installed the very necessary and minimal python packages. You may still need to install all other python packages which were uninstalled in 1st step.
Few Extra Notes:
2nd steps deleted 3rd party python packages as well which were installed globally using pip. Unfortunately, I was not having the list and ended up with few troubles which my projects who need them. But that was not a big deal as all my projects were having their own python requirements.txt file. But still I suggest you all to save the python packages in a file before starting the 1st step. Following command can come in handy:
pip freeze > python_pip_packages.txt
Also I had to delete pip files and directories(similar to how I deleted python default files and directories) and re-installed pip:
sudo apt-get install python-pip # installing pip
sudo pip install --upgrade pip # upgrading pip to latest version using pip itself
sudo pip install -r python_pip_packages.txt # re-installing all 3rd party python packages which were removed in 2nd step.
Hope others don't suffer like me :)
answered Apr 21 at 17:10
Saurav Kumar
10.2k134464
10.2k134464
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
add a comment |
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
1
1
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
Thanks for posting this. I don't know for sure how my system got into this state, but I believe it was an upgrade from 16.04.3 to 16.04.4
– Pete
May 20 at 22:11
add a comment |
up vote
1
down vote
For those who keep getting stuck while running commands (where it constantly complains about python or any other package), I went through the same and sorted that problem by removing the information from
/var/lib/dpkg/info/<the package giving you headache>
After that, should allow you to proceed with installations/upgrade/updates
add a comment |
up vote
1
down vote
For those who keep getting stuck while running commands (where it constantly complains about python or any other package), I went through the same and sorted that problem by removing the information from
/var/lib/dpkg/info/<the package giving you headache>
After that, should allow you to proceed with installations/upgrade/updates
add a comment |
up vote
1
down vote
up vote
1
down vote
For those who keep getting stuck while running commands (where it constantly complains about python or any other package), I went through the same and sorted that problem by removing the information from
/var/lib/dpkg/info/<the package giving you headache>
After that, should allow you to proceed with installations/upgrade/updates
For those who keep getting stuck while running commands (where it constantly complains about python or any other package), I went through the same and sorted that problem by removing the information from
/var/lib/dpkg/info/<the package giving you headache>
After that, should allow you to proceed with installations/upgrade/updates
answered Sep 28 at 17:00
Diogo Santo
1113
1113
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1026780%2ferror-upgrading-ubuntu-16-04-lts-python-minimal-package-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
This is a good time to restore your drive from a backup and take another run at it.
– SDsolar
Apr 20 at 20:36
You should move your python stuff out the way from
/usr/local
. And then retry withsudo apt-get install -f
,sudo dpkg --configure -a
.– N0rbert
Apr 20 at 21:13