Christian Primozich
Christian Primozich

Reputation: 61

Problems installing MySQLdb Python module on linux AMI

I'm trying to get a linux ami set up in ec2 with mysql (5.1 or later), python (2.6 or later) and the mysqldb python module. There are 2 options, starting from scratch or resolving issues in what I've started.

Can you anyone suggest an ami and associated commands to get this configuration going if starting from scratch is easiest?

Here's what I've tried. I started with this ami: LAMP_Rails_Python_plus_goodies (ami-5db76434). That gives me mysql and python. I have the mysqldb module but I believe it requires the python-devel package. I try to install that with the following:

yum install python-devel

That results in:

Transaction Check Error:
  file /etc/rpm/macros.python from install of python-1:2.6-2.22.amzn1.noarch conflicts with file from package system-release-2011.09-2.3.noarch

That's where I get stuck. I don't know how to resolve that conflict. Building the mysqldb module (python setup.py build) results in:

In file included from _mysql.c:29:
pymemcompat.h:10:20: error: Python.h: No such file or directory
_mysql.c:30:26: error: structmember.h: No such file or directory
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
_mysql.c:39:26: error: mysqld_error.h: No such file or directory
_mysql.c:40:20: error: errmsg.h: No such file or directory
_mysql.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

Googling leads me to believe that I need python-devel installed. Maybe I should use a different ami but I feel like I'm playing a guessing game at this point. Thanks for any help.

Upvotes: 2

Views: 2417

Answers (2)

Hakan B.
Hakan B.

Reputation: 2379

Run yum update -y prior to running yum install python-devel and it should install properly (no transaction check error).

Upvotes: 3

m1tk4
m1tk4

Reputation: 3477

You could install it by downloading the RPM and installing it using rpm -ivH --replacefiles .rpm. This, however, means that either your python rpm was not really made for your distribution (or wasn't really tested well).

In other words, STUFF MAY BREAK.

Upvotes: 0

Related Questions