Sunday, 8 September 2013

Installing MySQLdb

Installing MySQLdb

This is a common issue, but I've been unable to solve it. Boy this sort of
stuff gets me frustrated. I want python 2.6 with MySQLdb on a CentOS
machine. Should be easy, but it's not.
I've installed python 2.6 using EPEL:
$ wget
http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
$ sudo rpm -ivh epel-release-5-4.noarch.rpm
$ sudo yum groupinstall 'Development Tools'
$ sudo yum install readline-devel zlib-devel openssl-devel
$ sudo yum install python26*
$ sudo yum install mysql-devel mysql-server
1) This includes a package called python26-mysqldb, but the MySQLdb module
is not available. Why not? What does this package do?
$ sudo yum install python26-mysqldb
...
Package python26-mysqldb-1.2.3-2.el5.x86_64 already installed and latest
version
Nothing To do
$ python26
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
2) This also includes a package called python26-distribute.noarch, but the
setuptools module is not there. Why not? What does this package do?
$ sudo yum install python26-setuptools
...
Package python26-distribute-0.6.10-4.el5.noarch already installed and
latest version
Nothing to do
$ python26
>>> import setuptools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named setuptools
3) Pypy wget is unable to establish SSL connection when trying to download
setuptools. Why not? Should I be worried, or just use
--no-check-certificate? What's the point?
$ wget
https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.4.tar.gz
--2013-09-08
13:46:07--
https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.4.tar.gz
Resolving pypi.python.org... 199.27.77.185, 199.27.77.184
Connecting to pypi.python.org|199.27.77.185|:443... connected.
ERROR: certificate common name `*.a.ssl.fastly.net' doesn't match
requested host name `pypi.python.org'.
To connect to pypi.python.org insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
4) setuptools says "Currently, Distribute disallows installing Setuptools
0.7+ over Distribute. You must first uninstall any active version of
Distribute first". Do i have an "active version" of Distribute? On the one
hand, it's installed, but on the other hand setuptools is unavailable.
Finally, I gave up and came here.
Is there a key step that I've missed along the way that would alleviate
the problems I am having?

No comments:

Post a Comment