Missing MySQLdb module although it is installed

Hello there,

i’ve tried to upgrade from seafile-server 7.1.5 to 8.0.2.
I followed the upgrade notes (https://manual.seafile.com/upgrade/upgrade_notes_for_8.0.x/) and installed apt-get install libmysqlclient-dev (i’m using ubuntu) and then sudo pip3 install future mysqlclient which worked great. But when i try to start seahub i get the following error message:

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

But the output of sudo pip3 install mysqlclient is: Requirement already satisfied: mysqlclient in /usr/local/lib/python3.5/dist-packages (2.0.3)

Thanks for any help!

Best Regards
David

I’m not sure, especially since 7.1.5 seems to have worked for you. (As you upgraded from 7.1.5 to 8.0.2)
But at least for the rpi-version of seafile, from 7.1.x onwards, Python 3.5 was not sufficient, it required 3.6 or 3.7. Not sure about the generic linux version, I never used it. The upgrade notes for 7.1.x only state

To support both Python 3.6 and 3.7, we no longer bundle python libraries with Seafile package.

Why am I writing about this?
You said that mysqlclient is in /usr/local/lib/python3.5/dist-packages - which looks a lot like you’re using Python 3.5.

Again, I’m not an expert, that’s just something I noticed which might help you. Good luck!

Thanks for your reply and your suggestion @squirrel! (although you’re not an expert :slight_smile:)

Maybe you’re right.
To find out which python version I have installed I typed
python3 --version which gave me Python 3.6.3.
So I assume that Python 3.6.3 is installed but the MySQLdb module is only installed on Python Version 3.5… (assuming that Seafile also uses Python 3.6, this could be the error)
So do you (or anyone else) have an idea how i can install the MySQLdb module for Python Version 3.6?
And also (for further debugging): how can I see which Python Version Seafile is using?

I’m thankful for anyone response and suggestions, so feel free :slightly_smiling_face:

Best regards
David

What does pip3 -V give you? Is it using 3.6 or 3.5?
Maybe pip3 wasn’t upgraded when python3 was - or at least the new version wasn’t referenced? Btw, which Ubuntu version are you using?

You might be able to use python3.6 -m pip install mysqlclient to explicitly use the python-3.6 version of pip.

1 Like

You were completely right!
It’s working now, thank you very much!

pip3 -V gave me python 3.5 so I used the command you suggested python3.6 -m pip install mysqlclient and updated pip from version 9 to 21 via python3.6 -m pip install --upgrade pip.
pip3 -V gives me now python 3.6 and Seafile is starting and working properly.
I’m using Ubuntu 16.04 LTS

Thanks for your help! @squirrel

Best regards
David

1 Like

You’re welcome. Glad I could help :slight_smile:

1 Like