I accidentally removed python, now apt-get is completely broken

2

So I was having problems installing certbot/letsencrypt becaus eof a python Error. So i decided to remove python

apt-get remove --purge python

But I cannot apt-get install python because It complains about python not being installed to install it.

Anyway I've heard I can try to install all the python packages manually via dpkg, How do I do this.

Should I download packages sepearteley or can it be done with dpkg? And If so, How do I do this?


Edit:

enter image description here

(Im using python2.7) So its obviusly not installed for python2.7? only 3 Thanks.

Niall

Posted 2018-01-15T16:46:19.113

Reputation: 41

3"with great power comes great responsibility"... – Attie – 2018-01-15T16:50:44.190

what version of Debian are you on? depending on how many other critical system packages you've also removed... this could either be straightforward to fix, or not worth the hassle (easier to reinstall) – Attie – 2018-01-15T16:51:05.560

@Attie yes I should have done my research first.. – Niall – 2018-01-15T16:51:27.663

@Attie I am using Stretch (Raspberry pi) – Niall – 2018-01-15T16:51:40.160

On my current OS install everything has been trouble installing, nodejs didnt work , mariadb didnt work..... Everything has been trouble im wondering If I just format and start again. It would only take a few seconds If everything went to plan, this install took 5 hours.. – Niall – 2018-01-15T16:57:10.777

@Attie ok I think Ive fixed some python, not sure how. ButI'm just getting one error. ImportError: no module named site – Niall – 2018-01-15T16:57:53.197

Im guessing then somethin (site.py most liekly) is missing? – Niall – 2018-01-15T16:58:06.463

@Attie Ive edited in a screenshot which might be helpful. – Niall – 2018-01-15T17:02:44.920

I've just done apt-get remove --purge python followed by apt-get install python with no problems on a fresh image... what else did you do? =) – Attie – 2018-01-15T17:04:25.610

@Attie I'm pretty sure thats all I did but after I had alot of unmet dependencies and god know I cant remember, Im gonna try an apt-get install python now. – Niall – 2018-01-15T17:06:53.867

@Attie I cant purge python now.... Im getting PYTHONHOME error and what not. I think I will reinstall when I have time... – Niall – 2018-01-15T17:09:14.873

Sounds like a good plan – Attie – 2018-01-15T17:10:53.793

2The apt intself does not depend on Python (it's written in C++). Supposedly you have another package (which depends on Python) in a botched state, and when apt tries to configure it, it fails. I'd try running apt-get install python with --fix-broken and --ignore-missing command-line options for a start. – kostix – 2018-01-15T17:58:55.943

No answers