I have a Raspberry Pi 4 that I use as a file server. For some reason, the Python3 version was stuck at 3.7.3. I ran a apt update but to no avail so decided to uninstall Python completely to perform a clean install. I was wrong!

Lesson Learned: Don’t Mess With Python!

After removing Python and Python3, I restarted the Raspberry Pi. I was about to open a terminal and reinstall but something unexpected happened: The desktop didn’t restore. All I got was an empty screen with the wallpaper. When I clicked on the desktop, I could get a context menu. Through that, I could open a terminal, web browser or any other application but the desktop wasn’t working. Also, I could not access my network shares.

The moral of the story is Python is deeply integrated in the Raspbian OS and it’s not a good idea to uninstall/purge completely because of all its dependencies.

At this point, I opened a terminal and reinstalled both Python versions. Rebooted again but wasn’t able to get my desktop back and the network shares still failed.

Solution

Fortunately, the solution was fairly simple. After a lot of trial and error and searching, I finally found the solution:

sudo apt install --reinstall raspberrypi-ui-mods

After another reboot, I was able to get my desktop.

However, the file shares were still not working. At this point, I realized the Samba service was completely uninstalled because it had dependencies on Python.

So to resolve this issue I ran the following to reinstall the Samba service:

sudo apt install samba

Another reboot and everything was back to normal!

Conclusion

My Python version is still stuck on 3.7.3 on that Pi but I learned my lesson not to mess with Python willy nilly. Certainly don’t uninstall completely as it will break a lot of dependencies and reinstalling won’t fix those issues so be careful when dealing with Python versions.