CleanUp Server / remove Python2 pre-requirements

You can call me a dumb-head, a freak or flatout paranoid, but I tend to clean up my server after migrating to new seafile with full python3 support. Not because I need the 100 MB I regained, more is the fact that the old python is no longer supported and I dont want these lying on my system anymore.
I’m not a great UNIX Admin, but I’m highly precisely, don’t want to break stuff and therefor spread things apart, that most of you experts will likely do in one go.

Nevertheless maybe some of you also want to clean up old prerequirements after updating to the latest Seafile version. Then this might help you.

Diclaimer:

  • I’m using Ubuntu, I don’t know how this translates to other OSes.
  • I have a virtual preproduction seafile server that is identically setup to my production server. I made a snapshot on the preprod, then uninstalled stuff, restarted the preprod, did some testing and THEN ultimately did the exact same uninstallation on the production server + testing.
  • I might not use/test everthing you do (e.g. I dont use LDAP or MemCache) consider the below table to your environment
  • I’m not responsible for you breaking your Server.

Here we go:
My old Seafile 6.x Installation pre-requirements:
sudo apt-get install openjdk-8-jre poppler-utils libpython2.7 python-pip \ mysql-server python-setuptools python-pil python-mysqldb python-memcache python-ldap \ python-urllib3

My new Seafile 7.1.3 Installation pre-requirements:
sudo apt-get install python3-setuptools python3-pip

pip3 install --timeout=3600 pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha

After installing the new requirements and sucessfully upgrading to seafile 7.1.3 this is the cleanup:
I couldn’t copy the table nicely into the editor here so I put it in as a picture.

Be aware, that I uninstalled stuff from the buttom to the top. Shouldn’t mater, but not sure…
I copied the content of the “how” colum, so it essentially boils down to (bottom to top)::

sudo apt-get purge poppler-utils
sudo apt-get purge libpython2.7  
sudo apt-get purge python-pip
sudo apt-get purge python-setuptools
sudo apt-get purge python-pil
sudo apt-get purge python-memcache
sudo apt-get purge python-mysqldb
sudo apt-get purge python-ldap
sudo apt-get purge python-urllib3
sudo apt-get purge python-requests
sudo pip uninstall pillow
sudo pip uninstall moviepy
sudo apt-get purge ffmpeg 

any finally:
sudo apt autoremove

That’s its for Now.

You can imagine that the OS still has a lot of python2 packages installed:
dpkg -l *python

shows them:

But this is something for any other day…

6 Likes

@mulmer thanks for sharing your results