I wrote earlier about my not quite satisfactory attempt to install cmemcache on Ubuntu. After stumbling upon this exhaustive guide on how to set up a full-blown Django environment under Ubuntu I thought I’d try the apt-get route for libmemcache too. All you need to do to get libmemcache and the necessary header files installed is:
sudo apt-get install libmemcache-dev libmemcache0
After that, the steps for installing cmemcache itself are the same as before. The good news is that libmemcache and cmemcache both get installed without fuss using this approach, without any need for manual patching. The bad news is that the test.py suite still fails with same error message as before.
I cannot say that I fully understand the significance of this test failing. It might be harmless, but I sure like my tests to pass successfully so cmemcache will remain on my naughty list for now. Left with only python-memcached as a choice, I installed it instead, which was a breeze compared to cmemcache:
wget ftp://ftp.tummy.com/pub/python-memcached/python-memcached-1.43.tar.gz tar xvfz python-memcached-1.43.tar.gz cd python-memcached-1.43/ sudo apt-get install python-setuptools sudo python setup.py install
python-setuptools is used by the setup.py script, so it needs to be installed before running the setup. Once done, you can test python-memcached almost identically to cmemcache earlier (memcached needs to run in the background on localhost for this to work):
>>> import memcache >>> c = memcache.Client(['127.0.0.1:11211']) >>> c.set('testkey', 'testval') True >>> c.get('testkey') 'testval' >>>