1 Vote Vote

python with mysql on windows: installation errors

Posted by topdog 215 days ago Questions| python django module All

Hi all,

I tried to run the following command, in the folder of my django project

$ python manage.py dbshell

It shows me this error:

$python manage.py dbshell
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line
362, in execute_manager
    utility.execute()
  File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line
303, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python25\lib\site-packages\django\core\management\base.py", line 195,
 in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python25\lib\site-packages\django\core\management\base.py", line 222,
 in execute
    output = self.handle(*args, **options)
  File "C:\Python25\lib\site-packages\django\core\management\base.py", line 351,
 in handle
    return self.handle_noargs(**options)
  File "C:\Python25\lib\site-packages\django\core\management\commands\dbshell.py
", line 9, in handle_noargs
    from django.db import connection
  File "C:\Python25\lib\site-packages\django\db\__init__.py", line 41, in <modul
e>
    backend = load_backend(settings.DATABASE_ENGINE)
  File "C:\Python25\lib\site-packages\django\db\__init__.py", line 17, in load_b
ackend
    return import_module('.base', 'django.db.backends.%s' % backend_name)
  File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
    __import__(name)
  File "C:\Python25\lib\site-packages\django\db\backends\mysql\base.py", line 13
, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No mo
dule named MySQLdb

First question is, why Python does not simply include this MySQLdb module.

Ok, just fine, try to search to solve this message.

I have looked around stackoverflow.com for istalling this module but not have a good result.

Download this module at: http://sourceforge.net/projects/mysql-python/

Comes to the installation of this module on my vista system After the extraction of the package, I run the cmd prompt to continue with the installation:

$ python setup.py install

Again it showed me one other message:

D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    from setuptools import setup, Extension
ImportError: No module named setuptools

Playing around with this error message, I know that there is the ez_setup.py within the package:

$python ez_setup.py

It seems that everything is ok:

D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python ez_setup.py
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py
2.5.egg
Processing setuptools-0.6c9-py2.5.egg
Copying setuptools-0.6c9-py2.5.egg to c:\python25\lib\site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install-script.py script to C:\Python25\Scripts
Installing easy_install.exe script to C:\Python25\Scripts
Installing easy_install-2.5-script.py script to C:\Python25\Scripts
Installing easy_install-2.5.exe script to C:\Python25\Scripts

Installed c:\python25\lib\site-packages\setuptools-0.6c9-py2.5.egg
Processing dependencies for setuptools==0.6c9
Finished processing dependencies for setuptools==0.6c9

Now comes back to the setup.py to install again:

$python setup.py install

It again gave me one other error message:

D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install
running install
running bdist_egg
....
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.5\MySQLdb\constants
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

Any idea or thought about my process is welcomed :-s

Thank you everyone.

Discuss Bury


Who Voted for this Question