I’m facing this error when upgrading from 4.2.x to 4.3.x: “No module named mysql” or “No module named MySQLdb”

Example error when trying to install services:

55%20AM

Summary :

The upgrade from Arcadia 4.2 to 4.3 includes a change in the versions of python supported to run the Arcadia Visualization Server (changed from 2.6 to 3.6). As a result, you may have some custom settings that reference versions of libraries that changed after python3 in your Arcviz Settings (if using Ambari/HDP) or your Arcadia Visualization Server Safety Valve (settings_cm.py) if you’re using Cloudera Manager. In this particular case, there were some Database settings where class references had changed from the updates in our python and Django versions.

Below is the old version of the DATABASES Django settings configuration:

DATABASES = {
  'default': {
    # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'ENGINE': 'mysql.connector.django',
    'NAME': 'arcadia',
    'USER': '<my arcadia db user>',
    'PASSWORD': '<my arcadia db password>',
    # Empty for localhost through domain sockets or '127.0.0.1' for
    # localhost through TCP.
    'HOST': '',
    # Set to empty string for default.
    'PORT': '',
    # 'OPTIONS': {
    #      'autocommit': True,
    #    },
    }
}

To fix the issue, you must update the above config to look like this:

import pymysql
pymysql.install_as_MySQLdb()

DATABASES = {
  'default': {
    # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'arcadia',
    'USER': '<my arcadia db user>',
    'PASSWORD': '<my arcadia db password>',
    # Empty for localhost through domain sockets or '127.0.0.1' for
    # localhost through TCP.
    'HOST': '',
    # Set to empty string for default.
    'PORT': '',
    # 'OPTIONS': {
    #      'autocommit': True,
    #    },
    }
}

After making that update, and restarting the Arcadia Visualization Server, you should be able to access the Arcadia UI like normal.

1 Like