TG2 virtualenv MySQLdb ImportError

65 views
Skip to first unread message

AkA

unread,
Jun 19, 2009, 10:52:10 AM6/19/09
to TurboGears
Receive this error while trying to easy_install mysql-python in my
virtalenv (binary installer goes straight to the Python installation
directory and synchronizing dependencies virtualenv doesn't change a
thing):

Processing MySQL-python-1.2.3c1.tar.gz
Running MySQL-python-1.2.3c1\setup.py -q bdist_egg --dist-dir c:
\docume~1\functi
~1\locals~1\temp\easy_install-oecqsk\MySQL-python-1.2.3c1\egg-dist-tmp-
l9ecne
error: Setup script exited with 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.

I did install Visual C++ 2008 Express Edition with the free compiler
from http://www.microsoft.com/express/vc/ but after a reboot that
doesn't change a thing.
And when I try to initialise my database by the command
paster setup-app development.ini
I get the ImportError: No module named MySQLdb.

Anyone has a clue police?
Cheers

Chris Babcock

unread,
Jun 19, 2009, 1:40:50 PM6/19/09
to TurboGears
On Jun 19, 7:52 am, AkA <alexoploca...@gmail.com> wrote:
> Receive this error while trying to easy_install mysql-python in my
> virtalenv (binary installer goes straight to the Python installation
> directory and synchronizing dependencies virtualenv doesn't change a
> thing):
>

>% cut stuff that makes this look less like a turbogears question
%<

> And when I try to initialise my database by the command
> paster setup-app development.ini
> I get the ImportError: No module named MySQLdb.
>
> Anyone has a clue police?

I do the same thing every time...

TG defaults to sqlite, so it doesn't install MySQLdb for you, and
rightfully so. You can use easy_install, but you have to get the right
package name, case sensitive. I think it's mysqldbda.

Chris

AkA

unread,
Jun 28, 2009, 4:11:09 AM6/28/09
to TurboGears
Hi Chris,
Thanks for the reply.
Thought I could have a look before my short honeymoon but no until
today ;)
You're right that the package name is mysqldba from pypi.python.org/
simple.
Still I got stuck on this compiler error but now it's on a zope
component:
-------- -------- -------- --------
Running zope.security-3.7.0\setup.py -q bdist_egg --dist-dir c:
\docume~1\functi~
1\locals~1\temp\easy_install-y_181c\zope.security-3.7.0\egg-dist-tmp-
df9y2_
error: Setup script exited with 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.
-------- -------- -------- --------
Running $ paster setup-app development.ini still gets the error
"ImportError: No module named MySQLdb"
so I still couldn't get TG2 up and running with MySQL, sigh.

AkA

unread,
Jun 28, 2009, 7:34:20 AM6/28/09
to TurboGears
Ok, so I now even began from scratch to exclude any installation
mistakes.
Installed Python 2.5.2 like the TG2 documentation and walked through
all steps and tried easy_install mysqldb and binary installer.
Then tested quickstart on sqlite: no problem.
Finally tested quickstart on MySQL: again the infamous ImportError:
No module named MySQLdb
<a href="www.xs4all.nl/~ziggyzag/tginst.log">Log of all above</a>

AkA

unread,
Jun 29, 2009, 11:10:40 AM6/29/09
to TurboGears
Okay, so this monologue is now coming to an end:
finally got it working so I guess my trial and errors might serve
others by describing the steps to the solution.
Although it might even work with the advised version 1.22:
==> download MySQL-python.exe-1.2.1_p2.win32-py2.5.exe German hack
from
http://forums.mysql.com/read.php?50,129618,140611#msg-140611
==> renamed it to MySQL-python.exe-1.2.1_p2.win32-py2.5.zip and
extracted contents to lib\site-packages in virtualenv directory which
creates directory PLATLIB and move
contents to site-pacakages and try again step 21
=>
Successfully setup
==> $ paster serve development.ini
==> test in browser
=>
[tested ok]

AkA

unread,
Jun 29, 2009, 11:12:51 AM6/29/09
to TurboGears
Original link to 1.2.1_p2 version:
http://biohackers.net/wikiattach/Python2(2e)5/attachments/MySQL-python.exe-1.2.1_p2.win32-py2.5.exe
But as I said, the rename to zip and extract to site-packages in
virtualenv might work as well with the 1.2.2 version...

Florent Aide

unread,
Jun 29, 2009, 12:02:05 PM6/29/09
to turbo...@googlegroups.com
On Mon, Jun 29, 2009 at 5:10 PM, AkA<alexop...@gmail.com> wrote:
>
> Okay, so this monologue is now coming to an end:
> finally got it working so I guess my trial and errors might serve
> others by describing the steps to the solution.
> Although it might even work with the advised version 1.22:
> ==> download MySQL-python.exe-1.2.1_p2.win32-py2.5.exe German hack

you could easy_install the .exe instead of manually unzipping...

Florent.

AkA

unread,
Jun 30, 2009, 3:24:40 AM6/30/09
to TurboGears
Oh, well, thought only eggs were easy_installed, but in any case, like
with the Postgresql problem
[http://groups.google.nl/group/turbogears/browse_thread/thread/
6698b1c2a274b78d?hl=nl]
the solution is to unpack the driver to the virtualenv site-packages.
This should be documented with TG2.


On 29 jun, 18:02, Florent Aide <florent.a...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages