title: Getting flask fail to import error for flask-mysqldb when the module is already installed
body: <p>I was trying to learn to link flask with MySQL database from <a href="https://www.youtube.com/watch?v=6L3HNyXEais" rel="nofollow noreferrer">this</a> tutorial.</p>
  
  <p>I installed <code>flask-mysqldb</code> using pip3 into my virtual environment which was successful.</p>
  
  <p>There are some answers but they all cover <code>fail to install flask-mysqldb</code> in my case the installation itself is successful but I am still getting the error on the webpage.</p>
  
  <p>When I am starting the server using <code>flask run</code> and trying to run the routed URL <code>localhost:5000/</code> into the browser I am getting an Import Error for <code>flask-mysqldb</code>.</p>
  
  <p>This is the exact error I am getting:</p>
  
  <pre><code>flask.cli.NoAppException: While importing "todo_app", an ImportError was raised:
  
  File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 240, in locate_app
  __import__(module_name)
  
  File "/home/shubham/repos/academy-hackathon/week-0/day-3/my_todo_app/todo_app/app.py", line 7, in &lt;module&gt; 
  from flask_mysqldb import MySQL 
  
  File "/home/shubham/venv/lib/python3.6/site-packages/flask_mysqldb/__init__.py", line 1, in &lt;module&gt; 
  import MySQLdb 
  
  File "/home/shubham/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 18, in &lt;module&gt; 
  from . import _mysql 
  
  ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 338, in __call__
      self._flush_bg_loading_exception()
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 326, in _flush_bg_loading_exception
      reraise(*exc_info)
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
      raise value
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 314, in _load_app
      self._load_unlocked()
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 330, in _load_unlocked
      self._app = rv = self.loader()
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 388, in load_app
      app = locate_app(self, import_name, name)
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 247, in locate_app
      "\n\n{tb}".format(name=module_name, tb=traceback.format_exc())
  flask.cli.NoAppException: While importing "app", an ImportError was raised:
  
  Traceback (most recent call last):
    File "/home/shubham/venv/lib/python3.6/site-packages/flask/cli.py", line 240, in locate_app
      __import__(module_name)
    File "/home/shubham/repos/academy-hackathon/week-0/day-3/my_todo_app/todo_app/app.py", line 7, in &lt;module&gt;
      from flask_mysqldb import MySQL
    File "/home/shubham/venv/lib/python3.6/site-packages/flask_mysqldb/__init__.py", line 1, in &lt;module&gt;
      import MySQLdb
    File "/home/shubham/venv/lib/python3.6/site-packages/MySQLdb/__init__.py", line 18, in &lt;module&gt;
      from . import _mysql
  ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p><code>venv</code> is the name of the python environment</p>
  
  <p>I am not sure why I am getting this errror, I am running the server from the same python environment in which I installed the module <code>flask-mysqldb</code>.</p>
  
  <p>Also, I have anaconda-navigator installed on my machine on 'base' named environment I tried installing the module using <code>conda install flask-mysqldb</code> but it shows no module error. So is it possible that the error is due to the conda environment?</p>
  
  <p>Please suggest any solution, stuck on this from last night.</p>
  
  <p>Edit: 
  I found <a href="https://stackoverflow.com/a/34036383/7245003">here</a> that installing <code>MySQL-python</code> should fixed this problem, but I am getting another error while installing <code>MySQL-python</code></p>
  
  <pre><code>Collecting MySQL-python
    Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
      ERROR: Complete output from command python setup.py egg_info:
      ERROR: Traceback (most recent call last):
        File "&lt;string&gt;", line 1, in &lt;module&gt;
        File "/tmp/pip-install-9zyrtdz5/MySQL-python/setup.py", line 13, in &lt;module&gt;
          from setup_posix import get_config
        File "/tmp/pip-install-9zyrtdz5/MySQL-python/setup_posix.py", line 2, in &lt;module&gt;
          from ConfigParser import SafeConfigParser
      ModuleNotFoundError: No module named 'ConfigParser'
      ----------------------------------------
  ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-9zyrtdz5/MySQL-python/
  </code></pre>