I am having problems installing the mysql-python module in my server (CentOS 6.4 x86_64) with MySQL 5.6 installed and Python 2.6.6.

[python@localhost ~]$ rpm -qa | grep SQL

And when I try to install the last version of mysql-python through pip:

[python@localhost ~]$ pip install MySQL-python==1.2.4

I get a enormous compilation error which ends in:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 33: ordinal not in range(128)

Has someone has installed the mysql-python module in this conditions?

I'm attaching the log file in case it can help.

  • Your goal is to install latest version or stable one? – GioMac Aug 28 '13 at 16:48
  • My goal is to install the 5.6 version of MySQL because of the full-text search feature. – Axel Aug 28 '13 at 17:55
  • I mean MySQL-python, not MySQL :) – GioMac Aug 28 '13 at 17:59

Use yum to install required package:

yum install MySQL-python

Also, looks like you've installed mysql from mysql.com, it may break dependencies, because here is how original packages look like:

[root@main ~]# yum install mysql-server
Loaded plugins: downloadonly, security, versionlock
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.69-1.el6_4 will be installed
--> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-server-5.1.69-1.el6_4.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.69-1.el6_4.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.69-1.el6_4 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                       Arch                  Version                         Repository              Size
 mysql-server                  x86_64                5.1.69-1.el6_4                  updates                8.7 M
Installing for dependencies:
 mysql                         x86_64                5.1.69-1.el6_4                  updates                907 k
 perl-DBD-MySQL                x86_64                4.013-3.el6                     base                   134 k

Transaction Summary
Install       3 Package(s)

Total download size: 9.7 M
Installed size: 27 M
Is this ok [y/N]: 
  • I installed MySQL version 5.6 because of the InnoDB full-text search feature.Installing the 5.1 version is not an options, but thank you for the quick response! :) – Axel Aug 28 '13 at 17:55
  • yum install MySQL-python will work anyway - latest available stable version is MySQL-python-1.2.3-0.3.c1.1.el6. – GioMac Aug 28 '13 at 17:57

You can fix this UnicodeDecodeError by forcing pip use the default the default localization settings

LC_ALL=C pip install MySQL-python
  • This is a better answer if you're using virtualenv or tox and don't want the MySQL-python installed globally on your system. – aezell Jul 18 '14 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.