Problems:
Getting the following when trying to use MySQLdb in virtualenv’s django:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Activate and Run:
. bin/activate
pip install MySQLdb
Monthly Archives: November 2010
Django on CentOS Python 2.6 VirtualEnv Using GeekyMedia RPMs
Django on centos geekymedia
for setuptools (easy_install):
wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
easy_install *setuptools*
use it to install pip:
easy_install pip
download MySQLdb and install by:
python26 setup.py build
python26 setup.py install
download virtualenv
mkdir ~/.virtualenvs
add to .bashrc
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python26
source /usr/bin/virtualenvwrapper.sh
initialize virtualenv
mkdir dev
virtualenv dev
Start virtualenv for current session
source dev/bin/activate
now install packages, they will go inside virtualenv (since we are activated)
pip install django
pip install south
pip install pil
Create django project and app
cd dev/
django-admin.py startproject myproj
cd myproj
python manage.py startapp polls
Install Python 2.6 on CentOS 5.x
Steps to success:
- Download all the Python 2.6 rpm for your CentOS (i386 or x86_64) from geekymedia.
- Install tcl, tk, tix (required dependencies):
yum -y install tcl tk tix
- Install the geekymedia rpms.
Note that the python26-libs-2.6-geekymedia1.*.rpm and python26-2.6-geekymedia1.*.rpm must be installed together like this
rpm -Uvh python26-libs-2.6-geekymedia1.*.rpm python26-2.6-geekymedia1.*.rpm
. Similarly, *tools* and *tkinter* rpm must be installed together like thisrpm -Uvh *tools*rpm *tkinter*rpm
.
Yum update stops resolving dependencies for clamav-server
On my CentOS/VirtualMin server configured for RPMForge, I wanted to run yum update, but I was getting the following errors while resolving dependencies for the clam* packages (you can list them by typing: rpm -qa | grep clam
.
clamav-server-sysv-0.96-1.vm.el5.i386 from installed has depsolving problems
--> Missing Dependency: clamav-server = 0.96-1.vm.el5 is needed by package clamav-server-sysv-0.96-1.vm.el5.i386 (installed)
Error: Missing Dependency: clamav-server = 0.96-1.vm.el5 is needed by package clamav-server-sysv-0.96-1.vm.el5.i386 (installed)
I’ve had this problem on other servers where I had simply ignored it. But it was getting too much. So I researched and found the following solution working perfectly.
Solution
- Remove the clam rpms without removing the dependencies (virtualmin-base) by typing:
rpm --nodeps -e clamav-0.96-1.vm.el5
andrpm --nodeps -e clamav-server-sysv-0.96-1.vm.el5
. - Run yum update
And voila, I get the following:
Dependencies Resolved ===================================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================================== Installing: clamav i386 0.96.4-1.el5.rf rpmforge 2.2 M replacing clamav-lib.i386 0.96-1.vm.el5 clamav-db i386 0.96.4-1.el5.rf rpmforge 25 M replacing clamav-update.i386 0.96-1.vm.el5 clamd i386 0.96.4-1.el5.rf rpmforge 233 k replacing clamav-server.i386 0.96-1.vm.el5
Another solution: I have had servers that had conflicts even on the yum update, because maybe dependent packages came from conflicting repos. Specifically, clamav dependencies of rpmforge conflicted with clamav dependencies of virtualmin. To solve this, I ran: yum --disablerepo=* --enablerepo=virtualmin install clamav clamav-filesystem clamav-data clamav-lib
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package clamav.x86_64 0:0.96.5-1.vm.el5 set to be updated ---> Package clamav-data.x86_64 0:0.96.5-1.vm.el5 set to be updated ---> Package clamav-filesystem.x86_64 0:0.96.5-1.vm.el5 set to be updated ---> Package clamav-lib.x86_64 0:0.96.5-1.vm.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================================================== Package Arch Version Repository Size =========================================================================================================================================== Installing: clamav x86_64 0.96.5-1.vm.el5 virtualmin 934 k clamav-data x86_64 0.96.5-1.vm.el5 virtualmin 25 M clamav-filesystem x86_64 0.96.5-1.vm.el5 virtualmin 18 k clamav-lib x86_64 0.96.5-1.vm.el5 virtualmin 4.4 M Transaction Summary =========================================================================================================================================== Install 4 Package(s) Upgrade 0 Package(s) Total download size: 31 M Is this ok [y/N]: y Downloading Packages: (1/4): clamav-filesystem-0.96.5-1.vm.el5.x86_64.rpm | 18 kB 00:00 (2/4): clamav-0.96.5-1.vm.el5.x86_64.rpm (0%) 17% [======= ] 0.0 B/s | 160 kB --:-- ETA (3/4): clamav-lib-0.96.5-1.vm.el5.x86_64.rpm (3%) 3% [=- ] 0.0 B/s | 168 kB --:-- ETA (4/4): clamav-data-0.96.5-1.vm.el5.x86_64.rpm (17%) 0% [ ] 0.0 B/s | 40 kB --:-- ETA ------------------------------------------------------------------------------------------------------------------------------------------- Total 914 kB/s | 31 MB 00:34 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : clamav-filesystem 1/4 Installing : clamav-data 2/4 Installing : clamav-lib 3/4 Installing : clamav 4/4 Installed: clamav.x86_64 0:0.96.5-1.vm.el5 clamav-data.x86_64 0:0.96.5-1.vm.el5 clamav-filesystem.x86_64 0:0.96.5-1.vm.el5 clamav-lib.x86_64 0:0.96.5-1.vm.el5
Along with the above solution, you must remember to disable the conflicting repository. In this case, rpmforge. If rpmforge ever has a newer version of one of the clamav packages, and anyone runs yum update
, the dependencies will again stop resolving (because rpmforge and virtualmin repositories do not have a symbiotic relationship). To disable rpmforge, edit /etc/yum.repos.d/rpmforge.repo
and add/replace enabled=0
to the [rpmforge]
section. Also note, that anytime you want to explicitly use rpmforge, you can do yum --disablerepo=* --enablerepo=rpmforge
(or if you want to use it in conjunction with other enabled repositories, remove the –disablerepo flag).