« Authenticating Using Email vs Username | Home | Amazon EC2 Basics For The Curious »
Installing MySQLdb Without Python Egg Problems
By Paul Kenjora | May 31, 2008
When installing Django sooner or later you will come across a system that needs MySQLdb and sooner or later you will see the following error:
[Sat May 31 19:43:19 2008] [error] [client 99.165.134.196] PythonHandler django.core.handlers.modpython: ExtractionError: Can’t extract file(s) to egg cache\n\nThe following error occurred while trying to extract file(s) to the Python egg\ncache:\n\n [Errno 13] Permission denied: ‘/root/.python-eggs’\n\nThe Python egg cache directory is currently set to:\n\n /root/.python-eggs\n\nPerhaps your account does not have write access to this directory? You can\nchange the cache directory by setting the PYTHON_EGG_CACHE environment\nvariable to point to an accessible directory.\n
The fix is to set the PYTHON_EGG_CACHE environment variable before running the install. The install instructions do not make this clear and the error sounds like the path needs to be set after install. Here are the steps to avoid the above error.
- Download the tarball from SourceForge.
- $ tar zxvf [filename of MySQLdb tarball]
- $ cd [name of resulting directory]
- $ export PYTHON_EGG_CACHE=/var/cache/python-eggs
- $ mkdir /var/cache/python-eggs
- $ chmod 777 /var/cache/python-eggs
- $ python setup.py build
- $ python setup.py install
Thats it. I’ve only run into this issue on Fedora within Amazon EC2. Other platforms and versions of the MySQLdb module may work.
More from Aware Labs
- Installing Django on Gentoo The Hard Way
- UnicodeDecodeError Exception Fix On Templates
- Connecting To Oracle Directly (Without settings.py)
- Installing Django And MySQL On MacBook Air Or OS X
- Digg For Django Is Here
Aware Labs Recommends
- Getting Django up and running on Centos 5.2 with Apache(mod_python) and MySQL (Dougal Matthews)
- Better Python package management using source and version control systems (USwaretech)
- Why you should try Django : Agility (Dougal Matthews)
Topics: Environment Setup, Tutorial | Comments
-
pkenjora
-
pkenjora
-
pkenjora
-
pkenjora
-
pkenjora
-
Tim Wyatt
-
Brian