Ask Your Question
0

Import Error : No module named mysql

asked 2014-01-30 03:59:39 -0600

parash_hallur gravatar image

updated 2014-01-30 04:11:26 -0600

Hello 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 ...
(more)
edit retag flag offensive close merge delete

Comments

Following is the piece of Traceback error showing no module named mysql ----------------------------------------------------------- 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

parash_hallur gravatar imageparash_hallur ( 2014-01-30 04:00:47 -0600 )edit

From the screen -x attach, I see the following logs,

parash_hallur gravatar imageparash_hallur ( 2014-01-30 04:08:16 -0600 )edit

(keystone-all): 2014-01-30 04:34:36,004 DEBUG cfg log_opt_values identity.max_password_length = 4096 (keystone-all): 2014-01-30 04:34:36,004 DEBUG cfg log_opt_values ec2.driver = keystone.contrib.ec2.backends.sql.Ec2 (keystone-all): 2014-01-30 04:34:36,004 DEBUG cfg log_opt_values *************************************************************************** ***** (keystone): 2014-01-30 04:34:36,981 CRITICAL log logging_excepthook No module named mysql key failed to start

parash_hallur gravatar imageparash_hallur ( 2014-01-30 04:09:20 -0600 )edit

install mysql and also python client for mysql. This should set everything alright.

dheeru gravatar imagedheeru ( 2014-01-30 04:46:22 -0600 )edit

Dheeru: I have mysql and python-mysqldb installed *apt-get install python-mysqldb mysql-server* Are you suggesting to install more? When I checked the /usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects, I dont find the mysql folder there, I think that is the cause for the issue, how could I get it installed? Is copying mysql folder from the sqlalchemy solves the issue?

parash_hallur gravatar imageparash_hallur ( 2014-01-30 07:55:39 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2014-01-30 12:00:46 -0600

koolhead17 gravatar image
edit flag offensive delete link more
0

answered 2014-08-29 07:00:32 -0600

I had similar issue have you tried sudo apt-get install python-mysqldb

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-01-30 03:59:39 -0600

Seen: 10,836 times

Last updated: Aug 29 '14