Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problems installing MySQLdb on Windows [newbie]

Reply
Thread Tools

Problems installing MySQLdb on Windows [newbie]

 
 
Alex Meier
Guest
Posts: n/a
 
      12-28-2004
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
 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      12-28-2004
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/MySQ...in32-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
 
Reply With Quote
 
 
 
 
John Machin
Guest
Posts: n/a
 
      12-28-2004

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.

 
Reply With Quote
 
Alex Meier
Guest
Posts: n/a
 
      12-29-2004
In article <(E-Mail Removed)>, http://www.velocityreviews.com/forums/(E-Mail Removed) says...
> http://pydish.holdenweb.com/pwp/MySQ...in32-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.

Alex


--
remove underscore+nospam if you want to mail me
 
Reply With Quote
 
Alex Meier
Guest
Posts: n/a
 
      12-29-2004
(E-Mail 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

--
remove underscore+nospam if you want to mail me
 
Reply With Quote
 
Steve Holden
Guest
Posts: n/a
 
      12-29-2004
Alex Meier wrote:

> In article <(E-Mail Removed)>, (E-Mail Removed) says...
>
>>http://pydish.holdenweb.com/pwp/MySQ...in32-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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem installing MySQLdb/1.2.1_p2 with Python/2.4.1 and MySQL/5.0.18 Sean O'Donnell Python 2 01-05-2007 08:53 AM
Hard time with installing MySQLdb for Python on Linux gmax2006 Python 2 07-15-2006 06:45 AM
installing mysqldb errors matthew collins Python 0 10-13-2004 10:41 PM
problem installing MySQLdb on Solaris 8 Bob Swerdlow Python 0 05-26-2004 03:53 PM
Installing MySQLdb under Cygwin Perflubron Python 4 10-14-2003 09:51 AM



Advertisments