- zhensongren / uninstall_python3.MD
- Ye kisne de diye baccho ke haath mein laptop
- Footer
- Ubuntu, how do you remove all Python 3 but not 2
- 6 Answers 6
- I deleted package ‘python3’ on Ubuntu and I have lost dashboard, terminal and Unity. Help me to restore my data please [duplicate]
- 3 Answers 3
- How to restore after accidentally apt-get remove python
zhensongren / uninstall_python3.MD
bro did you find a way to fix it, my ubuntu also broken because of 2nd command. It would be grateful if you can help me with this.
Very careful before using above command.
In case you successfully uninstalled default package, use below command 😉
sudo apt-get install ubuntu-desktop
thank you my ubuntu was broken!! 🙂
bro did you find a way to fix it, my ubuntu also broken because of 2nd command. It would be grateful if you can help me with this.
I just used this command to fix ubuntu :
sudo apt-get install ubuntu-desktop
Very careful before using above command.
In case you successfully uninstalled default package, use below command 😉
sudo apt-get install ubuntu-desktop
Thank you!
My ubuntu was also broken
Destroyed my linux purging python, be careful
sudo apt-get purge . destroys dependencies . Be careful .
sudo apt-get install ubuntu-desktop
helps recover dependencies but not all
This is NOT the way to. do this.!
You will trash your system if you start purging like this.
Thank you for this. I had installed python3.10, it was causing problems and I couldn’t uninstall it through rm. I am still fairly new to linux so thank you.
yes, I’ve destroyed my computer and lost everything trying that, but my question still the same, how I can upgrade or deleted and then re-install the latest python version?
I use different python versions (3.8, 3.10) on my ubuntu. I decided to uninstall pythion3.10.
Now, anytime I install a package with pip, it is downloaded in ‘python3.10/site-packages/’ not ‘python3.8/site-packages/’
Does anyone know how I can resolve this? I cannot also install packages in a venv because it is always installing globally to ‘python3.10/site-packages/’
Please help. Thank you for your response
⚠ ⚠ ⚠ These commands ruined the whole WSL Ubuntu successfully! ⚠ ⚠ ⚠
thank you!
for readers in the future: just try searching and use other methods.
to repair python2.7 on Ubuntu: sudo apt-get install —reinstall python2.7 .
Note to self: Do not run commands on a github Gist without reading the comments section xD
I CANT BELIEVE UBUNTU CRASHED!! SUCH A FRAGILE USELESS OS
Some commands are best tried on virtual system first. Be careful.
installed and have no graphical interface
sudo apt install —reinstall ubuntu-desktop fixed
I ran this command and I’m using a WSL with Ubutu. Any ideas on how I can fix mine?
yall really testing these commands on your laptops ? what docker or vm did to you to hate using it so much
Very nice. I just blew my VM. Thanks for nothing.
What the hell, my terminal got removed
Ye kisne de diye baccho ke haath mein laptop
1st result when searching «ubuntu uninstall python» lmao
Thank you! My ubuntu was also broken 😅
Don’t try it or will distroy Your ubuntu
too late to read the comments
Thank you. I Just destroyed my ubuntu server
Destroyed my entire fing Ubuntu install, If anyone sees this comment, I would highly advise against using these commands, It will trash your system, if you fall victim to this, enter TTY console if you can, and type sudo apt-get update —fix-missing, then once this finishes, enter sudo apt install -f, this will fix the Ubuntu install, if it doesn’t you work you must reinstall Ubuntu somehow. For me, this method worked.
Footer
You can’t perform that action at this time.
Ubuntu, how do you remove all Python 3 but not 2
I have recently get hold of a RackSpace Ubuntu server and it has pythons all over the place: iPython in 3.5, Pandas in 3.4 &2.7, modules I need like pyodbc etc. are only in 2,7 Therefore, I am keen to clean up the box and, as a 2.7 users, keep everything in 2.7. So the key question is, is there a way to remove both 3.4 and 3.5 efficiently at the same time while keeping Python 2.7?
6 Answers 6
Removing Python 3 was the worst thing I did since I recently moved to the world of Linux. It removed Firefox, my launcher and, as I read while trying to fix my problem, it may also remove your desktop and terminal! Finally fixed after a long daytime nightmare. Just don’t remove Python 3. Keep it there!
If that happens to you, here is the fix:
@RohitNair Did you try the suggested fixes linked on my post (from askubuntu)? I tried them and they worked with me. If you don’t have a terminal (most probably), then press Ctrl+Alt+F1 to get a virtual console and get started
So, if a language version is removed, all hell breaks loose at the OS level? Not exactly an advertisement for Ubuntu.
EDIT: As pointed out in recent comments, this solution may BREAK your system.
You most likely don’t want to remove python3.
Please refer to the other answers for possible solutions.
Outdated answer (not recommended)
This stupid command removed many core packages from my system, and left it in a broken state, please remove this reply.
DO NOT run this command . python3 is used in many system utils and applications. RUNNING this command will destroy your system.
So I worked out at the end that you cannot uninstall 3.4 as it is default on Ubuntu.
All I did was simply remove Jupyter and then alias python=python2.7 and install all packages on Python 2.7 again.
Arguably, I can install virtualenv but me and my colleagues are only using 2.7. I am just going to be lazy in this case 🙂
You may want to dig deeper. Ubuntu still defaults to Python 2.7, although they are moving towards Python 3: wiki.ubuntu.com/Python/3 This could indicate a different issue with your setup.
First of all, don’t try the following command as suggested by Germain above.
`sudo apt-get remove 'python3.*'`
In Ubuntu, many software depends upon Python3 so if you will execute this command it will remove all of them as it happened with me. I found following answer useful to recover it.
If you want to use different python versions for different projects then create virtual environments it will be very useful. refer to the following link to create virtual environments.
Creating Virtual Environment also helps in using Tensorflow and Keras in Jupyter Notebook.
I deleted package ‘python3’ on Ubuntu and I have lost dashboard, terminal and Unity. Help me to restore my data please [duplicate]
I lost the dashboard and terminal. Even the desktop is blank. Also the top bar which shows time and other setting options are gone. Basically I can see my desktop wallpaper when I open my laptop. Whenever I open my laptop it shows following before showing the login. However, I can access the Ubuntu advanced options. I need to restore my data because it has my college projects.
This is why it is always good to read the output of a command before confirming the removal of essential packages. Also, in the future, maybe —dry-run can be helpful to avoid this sort of situation.
why? Why did you think it was a good thing to remove the python package? Basically half of Ubuntu is built in python.
3 Answers 3
You can press Ctrl + Alt + F5 to get a shell. Once there, try reinstalling Python and anything else you may be missing:
sudo apt-get install python3-all sudo apt-get install gnome-terminal
If nothing seems to work properly, or your dependencies have been messed up, try installing all of the desktop components again. This should give you all of the dependencies you need.
sudo apt-get remove ubuntu-desktop sudo apt-get install ubuntu-desktop
@Nobody ubuntu-deskop is just a meta package, so a reinstall will effectively do nothing in this case.
No, ubuntu-desktop installs all the related packages in my system. After I removed python accidentally when trying to upgrade from 16 to 18.
Python3 is used by many system components on Ubuntu.. removing that will break a lot (as you just witnessed). Can you try to simply reïnstal Python3 again with sudo apt-get install python3 ?
His problem appears to be that he has no access to the terminal, therefore has nowhere to enter the command to re-install python
Your current install is likely damaged beyond repair and needs to be wiped.
Boot up a live CD and mount your current install drive. Copy any important documents to a flash drive and reinstall Ubuntu.
Note that while you may be able to just reinstall Python, there may still be other (deeper) damage that isn’t just apparent yet. You can run the following command to try to repair your OS:
sudo apt-get install --reinstall ubuntu-desktop
How to restore after accidentally apt-get remove python
Yeah. I’ve done this. It was stupid. I did not know it’s going to take its dependencies with itself, only wanted to install python 2 and 3 from scratch (because of this problem: https://askubuntu.com/questions/897355/how-to-change-default-idle-for-python). Now, I can still use my terminal, checked these answers: https://askubuntu.com/questions/741265/apt-get-remove-python-150mb-apt-get-install-python-687kb https://askubuntu.com/questions/437644/i-accidentaly-did-sudo-apt-get-remove-python However after running sudo apt-get install ubuntu-desktop I get these errors:
Setting up python-ldb (2:1.1.24-1ubuntu3) . /var/lib/dpkg/info/python-ldb.postinst: 6: /var/lib/dpkg/info/python-ldb.postinst: pycompile: not found dpkg: error processing package python-ldb (--configure): subprocess installed post-installation script returned error exit status 127 No apport report written because MaxReports is reached already Setting up python-tdb (1.3.8-2) . /var/lib/dpkg/info/python-tdb.postinst: 6: /var/lib/dpkg/info/python-tdb.postinst: pycompile: not found dpkg: error processing package python-tdb (--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-samba: python-samba depends on python-crypto; however: Package python-crypto is not configured yet. python-samba depends on python-ldb (>= 1.1.2~); however: Package python-ldb is not configured yet. python-samba depends on python-tdb; however: Package python-tdb is not configured yet. dpkg: error processing package python-samba (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already Processing triggers for libc-bin (2.23-0ubuntu7) . Errors were encountered while processing: mercurial-common python-crypto python-dnspython python-ldb python-tdb python-samba E: Sub-process /usr/bin/dpkg returned an error code (1)