error processing package python-wheel

Asked by Tao

When I run python I do always have this error:

tao@tao:~/Downloads/oof2-2.1.11$ python setup.py build
bash: /usr/local/bin/python: No such file or directory
tao@tao:~/Downloads/oof2-2.1.11$

If I want to install software, there will also be some error for python:
tao@tao-Lenovo-IdeaPad-S410p-Touch:~$ sudo apt-get install synaptic
Reading package lists... Done
Building dependency tree
Reading state information... Done
synaptic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
7 not fully installed or removed.
Need to get 0 B/5,764 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python-colorama (0.3.1-0.1) ...
/var/lib/dpkg/info/python-colorama.postinst: 6: /var/lib/dpkg/info/python-colorama.postinst: pycompile: not found
dpkg: error processing package python-colorama (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: error processing package python-commandnotfound (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Setting up python-distlib (0.1.9-1) ...
/var/lib/dpkg/info/python-distlib.postinst: 6: /var/lib/dpkg/info/python-distlib.postinst: pycompile: not found
dpkg: error processing package python-distlib (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up python-html5lib (0.999-3) ...
/var/lib/dpkg/info/python-html5lib.postinst: 6: /var/lib/dpkg/info/python-html5lib.postinst: pycompile: not found
dpkg: error processing package python-html5lib (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up python-setuptools (5.5.1-1) ...
No apport report written because MaxReports is reached already
                                                              /var/lib/dpkg/info/python-setuptools.postinst: 6: /var/lib/dpkg/info/python-setuptools.postinst: pycompile: not found
dpkg: error processing package python-setuptools (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python-pip:
 python-pip depends on python-colorama; however:
  Package python-colorama is not configured yet.
 python-pip depends on python-distlib; however:
  Package python-distlib is not configured yet.
 python-pip depends on python-html5lib; however:
  Package python-html5lib is not configured yet.
 python-pip depends on python-setuptools (>= 0.6c1); however:
  Package python-setuptools is not configured yet.

dpkg: error processing package python-pip (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Setting up python-wheel (0.24.0-1) ...
/var/lib/dpkg/info/python-wheel.postinst: 6: /var/lib/dpkg/info/python-wheel.postinst: pycompile: not found
dpkg: error processing package python-wheel (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python-colorama
 python-commandnotfound
 python-distlib
 python-html5lib
 python-setuptools
 python-pip
 python-wheel
E: Sub-process /usr/bin/dpkg returned an error code (1)

What's wrong with python??

I got this error after I upgrade Ubuntu 14.10 from Ubuntu 13

Hope I could get answer because I'm a freshman with Ubuntu!!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Tao
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

There is no "Ubuntu 13". There is Ubuntu 13.04 (Codename Raring) and Ubuntu 13.10 (Codename Saucy).

How did you perform the upgrade?
What steps did you take?

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

What is the output of the commands

uname -a
lsb_release -a
which python
sudo apt-get install --reinstall --download-only python-minimal
sudo dpkg -i /var/cache/apt/archives/python-minimal_2.7.8-2_*.deb

Revision history for this message
Tao (taomo1003) said :
#3

Thanks for your reply!!

My old version is Ubuntu 13.04

I download an ISO online and boot from flash drive, after that I choose upgrade old version..

Yesterday I try to download Python-2.6.5 from www.pyhon.org and I install them by

sudo ./confiure
sudo make
sudo make install

and it seems work.

now if I command

      uname -a

output:
Linux tao-Lenovo-IdeaPad-S410p-Touch 3.16.0-24-generic #32-Ubuntu SMP Tue Oct 28 13:07:32 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

      lsb_release -a

output:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.10
Release: 14.10
Codename: utopic

      which python
output:
/usr/local/bin/python

      sudo apt-get install --reinstall --download-only python-minimal
output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
10 not fully installed or removed.
Need to get 0 B/33.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
Download complete and in download only mode

      sudo dpkg -i /var/cache/apt/archives/python-minimal_2.7.8-2_*.deb
output:
dpkg: error processing archive /var/cache/apt/archives/python-minimal_2.7.8-2_*.deb (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 /var/cache/apt/archives/python-minimal_2.7.8-2_*.deb

Thanks very much for helping me!!

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

Upgrading this way will probably cause issues.

What is the output of :

sudo apt-get --reinstall install python-minimal

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Upgrading this way will probably cause issues.

What is the output of :

sudo apt-get --reinstall install python-minimal

Thanks

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

I think the root cause of your problem is that you have manually installed a python version from another source which now interferes with the standard Ubuntu packages.

What is the output of the terminal commands

echo $PATH
/usr/local/bin/python --version
/usr/bin/python --version
apt-cache policy python-minimal
ls -l /var/cache/apt/archives/python-minimal
ls -l /usr/local/bin/py*
ls -l /usr/bin/py*

Revision history for this message
Tao (taomo1003) said :
#7

The output for
sudo apt-get --reinstall install python-minimal
is
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
Need to get 0 B/33.9 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 274117 files and directories currently installed.)
Preparing to unpack .../python-minimal_2.7.8-1_amd64.deb ...
Unpacking python-minimal (2.7.8-1) over (2.7.8-1) ...
Processing triggers for man-db (2.7.0.2-2) ...
E: Sub-process /usr/bin/dpkg returned an error code (1)

The output for
echo $PATH
/usr/local/bin/python --version
/usr/bin/python --version
apt-cache policy python-minimal
ls -l /var/cache/apt/archives/python-minimal
ls -l /usr/local/bin/py*
ls -l /usr/bin/py*

is
    echo $PATH:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

    /usr/local/bin/python --version
Python 2.7.8

    apt-cache policy python-minimal
python-minimal:
  Installed: 2.7.8-1
  Candidate: 2.7.8-1
  Version table:
 *** 2.7.8-1 0
        500 http://archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages
        100 /var/lib/dpkg/status

    ls -l /var/cache/apt/archives/python-minimal

ls: cannot access /var/cache/apt/archives/python-minimal: No such file or directory

    ls -l /usr/local/bin/py*
-rwxr-xr-x 1 root root 84 Nov 13 22:09 /usr/local/bin/pydoc
lrwxrwxrwx 1 root root 7 Nov 13 22:09 /usr/local/bin/python -> python2
lrwxrwxrwx 1 root root 9 Nov 13 22:09 /usr/local/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 7238424 Nov 13 00:21 /usr/local/bin/python2.6
-rwxr-xr-x 1 root root 1424 Nov 13 00:21 /usr/local/bin/python2.6-config
-rwxr-xr-x 1 root root 7808784 Nov 13 22:09 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 1674 Nov 13 22:09 /usr/local/bin/python2.7-config
lrwxrwxrwx 1 root root 16 Nov 13 22:09 /usr/local/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 14 Nov 13 22:09 /usr/local/bin/python-config -> python2-config

    ls -l /usr/bin/py*
-rwxr-xr-x 1 root root 7262 Oct 9 02:30 /usr/bin/py3clean
-rwxr-xr-x 1 root root 12113 Oct 9 02:30 /usr/bin/py3compile
lrwxrwxrwx 1 root root 31 Nov 12 21:28 /usr/bin/py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 26 Nov 12 21:28 /usr/bin/pybuild -> ../share/dh-python/pybuild
-rwxr-xr-x 1 root root 4123 Jul 12 01:12 /usr/bin/pyclean
-rwxr-xr-x 1 root root 11894 Jul 12 01:12 /usr/bin/pycompile
lrwxrwxrwx 1 root root 8 Nov 12 21:28 /usr/bin/pydoc -> pydoc2.7
-rwxr-xr-x 1 root root 79 Oct 20 12:07 /usr/bin/pydoc2.7
lrwxrwxrwx 1 root root 8 Nov 12 21:28 /usr/bin/pydoc3 -> pydoc3.4
-rwxr-xr-x 1 root root 79 Oct 8 10:17 /usr/bin/pydoc3.4
lrwxrwxrwx 1 root root 12 Nov 12 21:28 /usr/bin/pygettext -> pygettext2.7
-rwxr-xr-x 1 root root 22097 Oct 20 12:07 /usr/bin/pygettext2.7
lrwxrwxrwx 1 root root 12 Nov 12 21:28 /usr/bin/pygettext3 -> pygettext3.4
-rwxr-xr-x 1 root root 22368 Oct 8 10:17 /usr/bin/pygettext3.4
-rwxr-xr-x 1 root root 213 Feb 23 2014 /usr/bin/pygobject-codegen-2.0
-rwxr-xr-x 1 root root 326 Feb 23 2014 /usr/bin/pygtk-codegen-2.0
-rwxr-xr-x 1 root root 188 Feb 23 2014 /usr/bin/pygtk-demo
-rwxr-xr-x 1 root root 217 Oct 7 10:01 /usr/bin/pyhtmlizer
-rwxr-xr-x 1 root root 1066 May 1 2012 /usr/bin/pyNeighborhood
lrwxrwxrwx 1 root root 9 Jul 12 01:12 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root 9 Jul 12 01:12 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3781768 Oct 20 12:08 /usr/bin/python2.7
lrwxrwxrwx 1 root root 33 Oct 20 12:08 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root 16 Jul 12 01:12 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 9 Nov 12 21:28 /usr/bin/python3 -> python3.4
-rwxr-xr-x 1 root root 4476168 Oct 8 10:18 /usr/bin/python3.4
-rwxr-xr-x 1 root root 4476168 Oct 8 10:18 /usr/bin/python3.4m
lrwxrwxrwx 1 root root 10 Nov 12 21:28 /usr/bin/python3m -> python3.4m
lrwxrwxrwx 1 root root 16 Jul 12 01:12 /usr/bin/python-config -> python2.7-config
lrwxrwxrwx 1 root root 58 Jul 17 07:24 /usr/bin/pythontex -> ../share/texlive/texmf-dist/scripts/pythontex/pythontex.py
-rwxr-xr-x 1 root root 306 Jul 17 07:24 /usr/bin/pythontex3
lrwxrwxrwx 1 root root 29 Jul 12 01:12 /usr/bin/pyversions -> ../share/python/pyversions.py

Please help me with this, because I know I have totally massed up my Python...

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

You have two conflicting python installations, the Ubuntu-provided one in /usr/bin and the one you installed manually in /usr/local/bin. Your PATH setting gives priority to the manually installed one.

I cannot promise that it will work without problems, but I recommend that you delete all python-related files from /usr/local/bin. This hopefully will bring your package management system back to operations.

What is the output of

sudo dpkg --audit
sudo dpkg --configure -a
sudo dpkg --audit

Revision history for this message
Tao (taomo1003) said :
#9

Thank you very much for your reply!!

Please tell me how to delete all python-related files from /usr/local/bin...

The output of
sudo dpkg --audit
sudo dpkg --configure -a
sudo dpkg --audit

are

tao@tao-Lenovo-IdeaPad-S410p-Touch:~$ sudo dpkg --audit
[sudo] password for tao:
The following packages are in a mess due to serious problems during
installation. They must be reinstalled for them (and any packages
that depend on them) to function properly:
 python-commandnotfound Python 2 bindings for command-not-found.

tao@tao-Lenovo-IdeaPad-S410p-Touch:~$ sudo dpkg --configure -a
dpkg: error processing package python-commandnotfound (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python-commandnotfound

tao@tao-Lenovo-IdeaPad-S410p-Touch:~$ sudo dpkg --audit
The following packages are in a mess due to serious problems during
installation. They must be reinstalled for them (and any packages
that depend on them) to function properly:
 python-commandnotfound Python 2 bindings for command-not-found.

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

Ok, now try

sudo apt-get install --reinstall python-commandnotfound
sudo dpkg --audit

and copy/paste all output into this question document.

Revision history for this message
Tao (taomo1003) said :
#11

I've erase the whole system and install ubuntu14.10 again..
It works well!!

Thanks for all of your reply!!
It really helps me a lot!!

Tao