Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Import Error : No module named mysql

Hello stackers: I'm seeing the issue while stack install using devstack on Ubuntu VM. Everything was fine, I had the stack up and running, but I wanted to get the clean setup of devstack, so in an attempt to clean the devstack I did the following ./clean.sh ./unstack.sh

After that I have been seeing this issue of no module named 'mysql' and hence the keystone is not getting started, so the devstack install is failing. Could someone help me know what is the issue here?

I have the mysqldb-python package installed and mysql service is up and running.

Following are the stack installation logs.

/opt/stack/devstack/lib/database: line 100: recreate_database_: command not found
    + /opt/stack/keystone/bin/keystone-manage db_sync
    Traceback (most recent call last):
      File "/opt/stack/keystone/bin/keystone-manage", line 16, in <module>
        from keystone import cli
      File "/opt/stack/keystone/keystone/cli.py", line 23, in <module>
        from migrate import exceptions
      File "/usr/lib/python2.7/dist-packages/migrate/__init__.py", line 9, in <module>
        from migrate.changeset import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/__init__.py", line 21, in <module>
        from migrate.changeset.schema import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/schema.py", line 15, in <module>
        from migrate.changeset.databases.visitor import (get_engine_visitor,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
        from migrate.changeset.databases import (sqlite,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/sqlite.py", line 9, in <module>
        from sqlalchemy.databases import sqlite as sa_base
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/databases/__init__.py", line 14, in <module>
        from sqlalchemy.dialects.mysql import base as mysql
    ImportError: No module named mysql
    + [[ PKI == \P\K\I ]]
    + rm -rf /etc/keystone/ssl
    + /opt/stack/keystone/bin/keystone-manage pki_setup
    Traceback (most recent call last):
      File "/opt/stack/keystone/bin/keystone-manage", line 16, in <module>
        from keystone import cli
      File "/opt/stack/keystone/keystone/cli.py", line 23, in <module>
        from migrate import exceptions
      File "/usr/lib/python2.7/dist-packages/migrate/__init__.py", line 9, in <module>
        from migrate.changeset import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/__init__.py", line 21, in <module>
        from migrate.changeset.schema import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/schema.py", line 15, in <module>
        from migrate.changeset.databases.visitor import (get_engine_visitor,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
        from migrate.changeset.databases import (sqlite,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/sqlite.py", line 9, in <module>
        from sqlalchemy.databases import sqlite as sa_base
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/databases/__init__.py", line 14, in <module>
        from sqlalchemy.dialects.mysql import base as mysql
    ImportError: No module named mysql
    + sudo mkdir -p /var/cache/keystone
    + sudo chown stack /var/cache/keystone
    + rm -f '/var/cache/keystone/*'
    + start_keystone
    + local service_port=5000
    + is_service_enabled tls-proxy
    + services=tls-proxy
    + for service in '${services}'
    + [[ ,g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysq
    l, =~ ,tls-proxy, ]]
    + [[ tls-proxy == n-cell-* ]]
    + [[ tls-proxy == \n\o\v\a ]]
    + [[ tls-proxy == \c\i\n\d\e\r ]]
    + [[ tls-proxy == \c\e\i\l\o\m\e\t\e\r ]]
    + [[ tls-proxy == \g\l\a\n\c\e ]]
    + [[ tls-proxy == \n\e\u\t\r\o\n ]]
    + [[ tls-proxy == \s\w\i\f\t ]]
    + [[ tls-proxy == s-* ]]
    + return 1
    + screen_it key 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/
    keystone/logging.conf -d --debug'
    + SCREEN_NAME=stack
    + SERVICE_DIR=/opt/stack/status
    ++ trueorfalse True True
    ++ local default=True
    ++ local testval=True
    ++ [[ -z True ]]
    ++ [[ 0 no false False FALSE =~ True ]]
    ++ [[ 1 yes true True TRUE =~ True ]]
    ++ echo True
    ++ return
    + USE_SCREEN=True
    + is_service_enabled key
    + services=key
    + for service in '${services}'
    + [[ ,g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysq
    l, =~ ,key, ]]
    + return 0
    + screen_rc key 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/
    keystone/logging.conf -d --debug'
    + SCREEN_NAME=stack
    + SCREENRC=/opt/stack/devstack/stack-screenrc
    + [[ ! -e /opt/stack/devstack/stack-screenrc ]]
    + echo 'sessionname stack'
    + echo 'hardstatus alwayslastline '\''%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'\'''
    + echo 'setenv PROMPT_COMMAND /bin/true'
    + echo 'screen -t shell bash'
    + grep key /opt/stack/devstack/stack-screenrc
    ++ echo -ne '\015'
    + NL=$'\r'
    + echo 'screen -t key bash'
    + echo 'stuff "cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/ke
    "'tone/logging.conf -d --debug
    + [[ True = \T\r\u\e ]]
    + screen -S stack -X screen -t key
    + [[ -n '' ]]
    + sleep 1.5
    ++ echo -ne '\015'
    + NL=$'\r'
    + screen -S stack -p key -X stuff 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf
    '-log-config /etc/keystone/logging.conf -d --debug || echo "key failed to start" | tee "/opt/stack/status/stack/key.failure"
    + echo 'Waiting for keystone to start...'
    Waiting for keystone to start...
    + timeout 60 sh -c 'while ! http_proxy= curl -s http://10.247.99.119:5000/v2.0/ >/dev/null; do sleep 1; done'
    + die 316 'keystone did not start'
    + local exitcode=0
    + set +o xtrace
    [Call Trace]
    stack.sh:889:start_keystone
    /opt/stack/devstack/lib/keystone:316:die
    [ERROR] /opt/stack/devstack/lib/keystone:316 keystone did not start

Import Error : No module named mysql

Hello stackers: stackers:

This issue happens on Havana

I'm seeing the issue while stack install using devstack on Ubuntu VM. Everything was fine, I had the stack up and running, but I wanted to get the clean setup of devstack, so in an attempt to clean the devstack I did the following ./clean.sh ./unstack.sh

After that I have been seeing this issue of no module named 'mysql' whenever I do ./stack.sh and hence the keystone is not getting started, so the devstack install is failing. Could someone help me know what is the issue here?

I have the mysqldb-python package installed and mysql service is up and running.

Following are the stack installation logs.

/opt/stack/devstack/lib/database: line 100: recreate_database_: command not found
    + /opt/stack/keystone/bin/keystone-manage db_sync
    Traceback (most recent call last):
      File "/opt/stack/keystone/bin/keystone-manage", line 16, in <module>
        from keystone import cli
      File "/opt/stack/keystone/keystone/cli.py", line 23, in <module>
        from migrate import exceptions
      File "/usr/lib/python2.7/dist-packages/migrate/__init__.py", line 9, in <module>
        from migrate.changeset import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/__init__.py", line 21, in <module>
        from migrate.changeset.schema import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/schema.py", line 15, in <module>
        from migrate.changeset.databases.visitor import (get_engine_visitor,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
        from migrate.changeset.databases import (sqlite,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/sqlite.py", line 9, in <module>
        from sqlalchemy.databases import sqlite as sa_base
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/databases/__init__.py", line 14, in <module>
        from sqlalchemy.dialects.mysql import base as mysql
    ImportError: No module named mysql
    + [[ PKI == \P\K\I ]]
    + rm -rf /etc/keystone/ssl
    + /opt/stack/keystone/bin/keystone-manage pki_setup
    Traceback (most recent call last):
      File "/opt/stack/keystone/bin/keystone-manage", line 16, in <module>
        from keystone import cli
      File "/opt/stack/keystone/keystone/cli.py", line 23, in <module>
        from migrate import exceptions
      File "/usr/lib/python2.7/dist-packages/migrate/__init__.py", line 9, in <module>
        from migrate.changeset import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/__init__.py", line 21, in <module>
        from migrate.changeset.schema import *
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/schema.py", line 15, in <module>
        from migrate.changeset.databases.visitor import (get_engine_visitor,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/visitor.py", line 7, in <module>
        from migrate.changeset.databases import (sqlite,
      File "/usr/lib/python2.7/dist-packages/migrate/changeset/databases/sqlite.py", line 9, in <module>
        from sqlalchemy.databases import sqlite as sa_base
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/databases/__init__.py", line 14, in <module>
        from sqlalchemy.dialects.mysql import base as mysql
    ImportError: No module named mysql
    + sudo mkdir -p /var/cache/keystone
    + sudo chown stack /var/cache/keystone
    + rm -f '/var/cache/keystone/*'
    + start_keystone
    + local service_port=5000
    + is_service_enabled tls-proxy
    + services=tls-proxy
    + for service in '${services}'
    + [[ ,g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysq
    l, =~ ,tls-proxy, ]]
    + [[ tls-proxy == n-cell-* ]]
    + [[ tls-proxy == \n\o\v\a ]]
    + [[ tls-proxy == \c\i\n\d\e\r ]]
    + [[ tls-proxy == \c\e\i\l\o\m\e\t\e\r ]]
    + [[ tls-proxy == \g\l\a\n\c\e ]]
    + [[ tls-proxy == \n\e\u\t\r\o\n ]]
    + [[ tls-proxy == \s\w\i\f\t ]]
    + [[ tls-proxy == s-* ]]
    + return 1
    + screen_it key 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/
    keystone/logging.conf -d --debug'
    + SCREEN_NAME=stack
    + SERVICE_DIR=/opt/stack/status
    ++ trueorfalse True True
    ++ local default=True
    ++ local testval=True
    ++ [[ -z True ]]
    ++ [[ 0 no false False FALSE =~ True ]]
    ++ [[ 1 yes true True TRUE =~ True ]]
    ++ echo True
    ++ return
    + USE_SCREEN=True
    + is_service_enabled key
    + services=key
    + for service in '${services}'
    + [[ ,g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-sch,c-api,c-vol,n-sch,n-novnc,n-xvnc,n-cauth,horizon,rabbit,tempest,mysq
    l, =~ ,key, ]]
    + return 0
    + screen_rc key 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/
    keystone/logging.conf -d --debug'
    + SCREEN_NAME=stack
    + SCREENRC=/opt/stack/devstack/stack-screenrc
    + [[ ! -e /opt/stack/devstack/stack-screenrc ]]
    + echo 'sessionname stack'
    + echo 'hardstatus alwayslastline '\''%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'\'''
    + echo 'setenv PROMPT_COMMAND /bin/true'
    + echo 'screen -t shell bash'
    + grep key /opt/stack/devstack/stack-screenrc
    ++ echo -ne '\015'
    + NL=$'\r'
    + echo 'screen -t key bash'
    + echo 'stuff "cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --log-config /etc/ke
    "'tone/logging.conf -d --debug
    + [[ True = \T\r\u\e ]]
    + screen -S stack -X screen -t key
    + [[ -n '' ]]
    + sleep 1.5
    ++ echo -ne '\015'
    + NL=$'\r'
    + screen -S stack -p key -X stuff 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf
    '-log-config /etc/keystone/logging.conf -d --debug || echo "key failed to start" | tee "/opt/stack/status/stack/key.failure"
    + echo 'Waiting for keystone to start...'
    Waiting for keystone to start...
    + timeout 60 sh -c 'while ! http_proxy= curl -s http://10.247.99.119:5000/v2.0/ >/dev/null; do sleep 1; done'
    + die 316 'keystone did not start'
    + local exitcode=0
    + set +o xtrace
    [Call Trace]
    stack.sh:889:start_keystone
    /opt/stack/devstack/lib/keystone:316:die
    [ERROR] /opt/stack/devstack/lib/keystone:316 keystone did not start