Search code examples
pythonmysqldjangogoogle-app-enginegoogle-cloud-sql

Python Pip Install fails - Could not build the egg. Also cannot use 1.2.5 because of google cloud sql


I need mysql-python.

I get error of could not build egg while installing 1.2.4 Everywhere it says install 1.2.5, which works for me too.

But googleAppEngine's app.yaml supports only 1.2.4

libraries:
- name: MySQLdb
  version: "1.2.4"

So if I use 1.2.4 there, and 1.2.5 in the virtual env, I get the error -

ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb version (1, 2, 5, 'final', 1), but _mysql is version (1, 2, 4, 'final', 1)
    1:1430668397.857531 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

What is supposed to be done, either working with App engine or with 1.2.4 pip will do!


Solution

  • Run -

    pip uninstall mysql-python

    YAML - 
        libraries:
        - name: MySQLdb
          version: "1.2.4"
    

    Settings -

        'default': {
            'ENGINE':'django.db.backends.mysql',
            'HOST':'/cloudsql/ProjectName:DBName',
            'NAME': 'my_database',
            'USER': 'root',
            'PASSWORD': '********',
    }