Problems installing MySQLdb on Windows [newbie]

A

Alex Meier

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:

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:
['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
 
S

Steve Holden

Alex said:
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:




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:


['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
 
J

John Machin

Alex said:
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.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.Traceback (most recent call last):

(6) I suggest that you contact the package maintainer.
 
A

Alex Meier

(e-mail address removed) 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
 
S

Steve Holden

Alex said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top