4

I am on ubuntu 14.04 and I accidentally deleted python3.4

I am trying

apt-get install python3.4
dpkg-reconfigure -a
apt-get install -f

But I am seeing the following errors

dpkg: error processing package dh-python (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.4-minimal
 python3-minimal
 python3.4
 python3
 python3-pkg-resources
 python-chardet-whl
 python-pip-whl
 python3-chardet
 python3-colorama
 python3.4-dev
 python3-dev
 python3-distlib
 python3-six
 python3-html5lib
 python3-urllib3
 python3-requests
 python3-setuptools
 python3-pip
 python3-wheel
 dh-python
E: Sub-process /usr/bin/dpkg returned an error code (1)

I also tried to completely remove python3.4 using

apt-get remove --purge python3.4

and reinstalling. but it gives me the following errors

Rebuilding /usr/share/applications/bamf-2.index...
Setting up python3.4-minimal (3.4.3-1ubuntu1~14.04.3) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
dpkg: error processing package python3.4-minimal (--configure):
 subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3.4:
 python3.4 depends on python3.4-minimal (= 3.4.3-1ubuntu1~14.04.3); however:
  Package python3.4-minimal is not configured yet.

dpkg: error processing package python3.4 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.4-minimal
 python3.4
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can anyone help me with this?

output for @Nodak 's answer:

Rebuilding /usr/share/applications/bamf-2.index...
Setting up python3.4-minimal (3.4.3-1ubuntu1~14.04.3) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
dpkg: error processing package python3.4-minimal (--configure):
 subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3.4:
 python3.4 depends on python3.4-minimal (= 3.4.3-1ubuntu1~14.04.3); however:
  Package python3.4-minimal is not configured yet.

dpkg: error processing package python3.4 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.4-minimal (>= 3.4.0-0~); however:
  Package python3.4-minimal is not configured yet.

dpkg: error processing package python3-minimal (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3:
 python3 depends on python3.4 (>= 3.4.0-0~); however:
  Package python3.4 is not configured yet.
 python3 depends on python3-minimal (= 3.4.0-0ubuntu2); however:
  Package python3-minimal is not configured yet.

dpkg: error processing package python3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of dh-python:
 dh-python depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package dh-python (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.4-minimal
 python3.4
 python3-minimal
 python3
 dh-python
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is the output when I run dpkg-reconfigure -a

dpkg-reconfigure -a
acpid stop/waiting
acpid start/running, process 26874
avahi-daemon stop/waiting
avahi-daemon start/running, process 27149
Rebuilding /usr/share/applications/bamf-2.index...
update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode
update-initramfs: deferring update (trigger activated)
cgroup-lite stop/waiting
cgroup-lite start/running
/var/lib/dpkg/info/compiz.config: 1: /var/lib/dpkg/info/compiz.config: [general]: not found
/var/lib/dpkg/info/compiz.config: 2: /var/lib/dpkg/info/compiz.config: backend: not found
/var/lib/dpkg/info/compiz.config: 3: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found
/var/lib/dpkg/info/compiz.config: 5: /var/lib/dpkg/info/compiz.config: [gnome_session]: not found
/var/lib/dpkg/info/compiz.config: 6: /var/lib/dpkg/info/compiz.config: backend: not found
/var/lib/dpkg/info/compiz.config: 7: /var/lib/dpkg/info/compiz.config: integration: not found
/var/lib/dpkg/info/compiz.config: 8: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found
/var/lib/dpkg/info/compiz.config: 9: /var/lib/dpkg/info/compiz.config: profile: not found
/var/lib/dpkg/info/compiz.config: 11: /var/lib/dpkg/info/compiz.config: [general_ubuntu]: not found
/var/lib/dpkg/info/compiz.config: 12: /var/lib/dpkg/info/compiz.config: backend: not found
/var/lib/dpkg/info/compiz.config: 13: /var/lib/dpkg/info/compiz.config: integration: not found
/var/lib/dpkg/info/compiz.config: 14: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found
/var/lib/dpkg/info/compiz.config: 15: /var/lib/dpkg/info/compiz.config: profile: not found

2 Answers2

0

Try fully uninstalling python by running

sudo apt-get remove --purge python3.4

This will remove all dependencys installed with python

Then install python again by running

sudo apt-get install python3.4

Hope this helped,

Zimbinskers

So try installing just python not the specific version 3.4. There may be an issue with dependencys not properly being installed. So just run

sudo apt-get install python

And tell me the results.

Hope this helps,

Zimbinskers

0

It is a mystery.
I deleted /usr/lib/python3.4 then I sudo apt-get purge -f python3

(if you try this you might want a list of your packages to re-install those packages that are Python3 dependent and subsequently removed by apt-get magic.

Instructions how to do this

)

I then went to reinstall python3 sudo apt-get install -f python3. It failed.

sudo apt-get -f install was issued and a number of packages were installed.

Reissueing sudo apt-get install -f python3 succeeded in restoring the directory usr/lib/python3.4 and Python 3 functionality.

I reinstalled the packages lost as collateral damage.

Nodak
  • 680
  • 4
  • 10
  • I tried your method.

    apt-get install -f didnot install any packages and when i try to run apt-get install -f python3, I see some errors. I added that to my answer.

    I also tried running dpkg-reconfigure -a , it resulted in some errors as well. I added them to the answer

    – Kiran Vemuri Dec 21 '15 at 06:01
  • @KiranVemuri it's a mystery. I cannot replicate your results, nor you mine. Sorry. – Nodak Dec 21 '15 at 11:32
  • mysteries of the random bit world :) – Madivad Dec 30 '15 at 21:35