Problems installing MySQLdb on Windows [newbie]

Discussion in 'Python' started by Alex Meier, Dec 28, 2004.

  1. Alex Meier

    Alex Meier Guest

    hi, all!

    this is my first contact with python, I installed python 2.4 (on Win2k)
    and unzipped the MySQLdb package "MySQL-Python 1.0.0 for win32" into
    Lib/site-packages.

    However, when I try to import the MySQLdb package, I am faced with the
    error message "DLL load failed", in more detail:

    >>> import MySQLdb


    Traceback (most recent call last):
    File "<pyshell#9>", line 1, in -toplevel-
    import MySQLdb
    File "C:\Programme\Python24\lib\site-packages\MySQLdb\__init__.py",
    line 27, in -toplevel-
    import _mysql
    ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

    The directory structure is (only the relevant parts):

    C:\Programme\Python24
    |
    +-- Lib
    |
    +-- site-packages
    |
    +-- _mysql.pyd
    +-- _mysql_exceptions.py
    +-- CompatMysqldb.py
    +-- MySQLdb
    |
    +-- __init__.py
    +-- connections.py
    +-- ...

    One thing strikes me: in sys.path, the path to "site-packages" contains
    the dir "lib" (lowercase!) whereas in the file system it would be
    written "Lib" (mixed case). Could this pose a problem?

    This is the path:

    >>> sys.path

    ['C:\\Programme\\Python24\\Lib\\idlelib', 'C:\\WINNT\\system32
    \\python24.zip', 'C:\\Programme\\Python24', 'C:\\Programme\\Python24
    \\DLLs', 'C:\\Programme\\Python24\\lib', 'C:\\Programme\\Python24\\lib
    \\plat-win', 'C:\\Programme\\Python24\\lib\\lib-tk', 'C:\\Programme
    \\Python24\\lib\\site-packages']

    Any hints for me?

    TIA
    Alex

    --
    remove underscore+nospam if you want to mail me
    Alex Meier, Dec 28, 2004
    #1
    1. Advertising

  2. Alex Meier

    Steve Holden Guest

    Alex Meier wrote:

    > hi, all!
    >
    > this is my first contact with python, I installed python 2.4 (on Win2k)
    > and unzipped the MySQLdb package "MySQL-Python 1.0.0 for win32" into
    > Lib/site-packages.
    >
    > However, when I try to import the MySQLdb package, I am faced with the
    > error message "DLL load failed", in more detail:
    >
    >
    >>>>import MySQLdb

    >
    >
    > Traceback (most recent call last):
    > File "<pyshell#9>", line 1, in -toplevel-
    > import MySQLdb
    > File "C:\Programme\Python24\lib\site-packages\MySQLdb\__init__.py",
    > line 27, in -toplevel-
    > import _mysql
    > ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
    >
    > The directory structure is (only the relevant parts):
    >
    > C:\Programme\Python24
    > |
    > +-- Lib
    > |
    > +-- site-packages
    > |
    > +-- _mysql.pyd
    > +-- _mysql_exceptions.py
    > +-- CompatMysqldb.py
    > +-- MySQLdb
    > |
    > +-- __init__.py
    > +-- connections.py
    > +-- ...
    >
    > One thing strikes me: in sys.path, the path to "site-packages" contains
    > the dir "lib" (lowercase!) whereas in the file system it would be
    > written "Lib" (mixed case). Could this pose a problem?
    >

    No, Windows file lookups are not case-sensitive.


    > This is the path:
    >
    >
    >>>>sys.path

    >
    > ['C:\\Programme\\Python24\\Lib\\idlelib', 'C:\\WINNT\\system32
    > \\python24.zip', 'C:\\Programme\\Python24', 'C:\\Programme\\Python24
    > \\DLLs', 'C:\\Programme\\Python24\\lib', 'C:\\Programme\\Python24\\lib
    > \\plat-win', 'C:\\Programme\\Python24\\lib\\lib-tk', 'C:\\Programme
    > \\Python24\\lib\\site-packages']
    >
    > Any hints for me?
    >
    > TIA
    > Alex
    >

    I'm not sure that the Win32 installer is up to date for 2.4. I recently
    mailed Andy Dustman with a copy of the up to date installer I built, but
    I never had any acknowledgment and it doesn't appear to have found its
    way on to SourceForge yet.

    I'd suggest you use a binary installer. Remove everything that your
    current install attempt dropped under site-packages, and download and run

    http://pydish.holdenweb.com/pwp/MySQL-python.exe-1.0.0.win32-py2.4.exe

    That's a ready-to-go no-compilation-required installer for Windows
    Python 2.4, and will get you going straight away.

    regards
    Steve
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/
    Holden Web LLC +1 703 861 4237 +1 800 494 3119
    Steve Holden, Dec 28, 2004
    #2
    1. Advertising

  3. Alex Meier

    John Machin Guest

    Alex Meier wrote:
    > hi, all!
    >
    > this is my first contact with python, I installed python 2.4 (on

    Win2k)
    > and unzipped the MySQLdb package "MySQL-Python 1.0.0 for win32" into
    > Lib/site-packages.
    >
    > However, when I try to import the MySQLdb package, I am faced with

    the
    > error message "DLL load failed", in more detail:
    >


    (1) RTFHomePage (FIRST SENTENCE):
    """MySQL versions 3.22, 3.23 and 4.0; and Python versions 1.5.2-2.3 are
    supported. """

    Background: A .pyd has to be linked against a specific PythonXY.dll;
    see point (4) below.

    (2) A package which doesn't provide an installer but merely invites you
    to unzip everything into .../lib/site-packages is a bit dodgy. If you
    had have followed the instructions blindly, you would have ended up
    with a directory called mysql-python-1.0.0.win32-py2.3 [eeee, look,
    "2.3"] as a child of site-packages.

    (3) "Lib" versus "lib" is not the problem; if you examine your
    traceback, you will see that it found "Lib" even though "lib" was
    specified. Windows file names are not case-sensitive. However there can
    be Python-imposed problems which can be overcome (in the remote event
    that you meet these problems) by using the PYTHONCASEOK environment
    veriable.

    (4) Why you are getting the "DLL not found" message is beyond me, given
    your description of what you've done. Perhaps the picture is being
    obscured by your using "pyshell". What you should have got is something
    like this [I've extracted _mysql.pyd into my junk directory]:

    C:\junk>python
    Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _mysql

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    ImportError: Module use of python23.dll conflicts with this version of
    Python.
    >>>


    (5) But the _mysql.pyd appears to be a bit suspect anyway:

    C:\junk>\python23\python
    Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
    on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import _mysql

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    ImportError: _mysql: init failed
    >>>


    (6) I suggest that you contact the package maintainer.
    John Machin, Dec 28, 2004
    #3
  4. Alex Meier

    Alex Meier Guest

    Alex Meier, Dec 29, 2004
    #4
  5. Alex Meier

    Alex Meier Guest

    says...
    > (1) RTFHomePage (FIRST SENTENCE):
    > """MySQL versions 3.22, 3.23 and 4.0; and Python versions 1.5.2-2.3 are
    > supported. """


    I have to admit I took a chance because the error message led me to
    thinking it was a simple path problem or the like, not a version
    problem.

    Anyway, I got the whole thing up and running using the binary installer
    Steve has pointed me to. So my interest in finding out what really had
    happened has decreased somewhat - to say the least.

    Nevertheless, thank you for your extensive answer,
    Alex

    --
    remove underscore+nospam if you want to mail me
    Alex Meier, Dec 29, 2004
    #5
  6. Alex Meier

    Steve Holden Guest

    MySQLdb Windows Installer (2.4) published [was: Problems installingMySQLdb on Windows [newbie]]

    Alex Meier wrote:

    > In article <>, says...
    >
    >>http://pydish.holdenweb.com/pwp/MySQL-python.exe-1.0.0.win32-py2.4.exe
    >>
    >>That's a ready-to-go no-compilation-required installer for Windows
    >>Python 2.4, and will get you going straight away.

    >
    >
    > Thanx a lot, Steve! This worked without a hitch.
    >

    Great. I don't know what Andy Dustman's situation is right now, but he's
    clearly not got time to maintain MySQLdb. Since it's likely other people
    will want this I've added it to the Holden Web public domain Python page
    at http://www.holdenweb.com/Python/index.html -- that way Google might
    pick it up, who knows.

    regards
    Steve
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/
    Holden Web LLC +1 703 861 4237 +1 800 494 3119
    Steve Holden, Dec 29, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Perflubron

    Installing MySQLdb under Cygwin

    Perflubron, Oct 10, 2003, in forum: Python
    Replies:
    4
    Views:
    590
    Perflubron
    Oct 14, 2003
  2. Bob Swerdlow

    problem installing MySQLdb on Solaris 8

    Bob Swerdlow, May 26, 2004, in forum: Python
    Replies:
    0
    Views:
    440
    Bob Swerdlow
    May 26, 2004
  3. matthew collins

    installing mysqldb errors

    matthew collins, Oct 13, 2004, in forum: Python
    Replies:
    0
    Views:
    299
    matthew collins
    Oct 13, 2004
  4. gmax2006
    Replies:
    2
    Views:
    373
    Lawrence D'Oliveiro
    Jul 15, 2006
  5. John Nagle
    Replies:
    4
    Views:
    1,690
    Dennis Lee Bieber
    Jun 12, 2010
Loading...

Share This Page