Sunday, July 01, 2012

Windows 7 - Resuming from hibernation is slow on Thinkpad

This post describes the solution to a hibernation issue I had with Lenovo Thinkpad L412 laptop running Windows 7.

When waking up from hibernation the system resumed relatively fast, but then, for a minute or two after resuming, many applications (e.g. Explorer, Firefox) would be "not responding".

Additional symptoms:

  • During this period the disk activity was unexpectedly high, Resource Monitor indicated that most of it was paging (see the high "Hard faults" figure, and the c:\pagefile.sys requests on the screenshot), even though there was more than enough RAM available before hibernating.
  • The task manager also showed a drop in memory utilization -- the system used fewer memory after hibernating and resuming than before.

The program to blame for this behavior turned out to be this fine piece of software engineering:

"ThinkVantage Technologies Power Manager 6"

Just uninstall it and the problem is gone. You'll lose the large battery widget in the task bar and the confusing power management UI that mostly duplicates existing Windows functionality:

(If anyone wonders. the latest version at the time of writing (6.32) had this problem too.)

Troubleshooting tips that helped to identify the issue can be found here: Trace Windows 7 boot/shutdown/hibernate/standby/resume issues.

Sunday, May 13, 2012

Troubleshooting python packages installation

This post lists some of the problems encountered while trying to set up development environment for kuma, a Python (django-) based wiki engine.

I'm using Mac OS X 10.7, Macports as the package manager.

A note about virtualenv

virtualenv lets you install python packages for a particular project into an isolated environment.

When relying on macports to install dependencies, it's a good idea to use Python provided by Macports, otherwise the system might not see some of the dependencies you installed with Macports.

Using virtualenvwrapper, you can specify the python binary to use when creating the environment like this:

#assuming python2.7 is a macports binary (typically in /opt/local/bin)
mkvirtualenv kuma-test-py2.7 -p python2.7

Problems and solutions

Error installing MySQL-python: EnvironmentError: mysql_config not found

Via http://blog.infoentropy.com/MySQL-python_EnvironmentError_mysql_config_not_found: you need to edit site.cfg to point to the right mysql_config path.

In my case (with virualenv and macports mysql), I ended up modifying /Users/nickolay/.virtualenvs/<environment-name>/build/MySQL-python/site.cfg to point to /opt/local/bin/mysql_config5).

Errors involving pylibmc and memcached

_pylibmcmodule.h:42:36: error: libmemcached/memcached.h: No such file or directory

First make sure you installed libmemcached, e.g. using Macports:

sudo port install libmemcached

For some reason on my system I also needed to explicitly set the path to headers before retrying pylibmc installation:

export CPATH=/opt/local/include/

ld: library not found for -lmemcached, collect2: ld returned 1 exit status

This happened for me when trying to install into a virtualenv using system python, not macports one. (See the section on virtualenv above.)

ImportError: failed to find libmagic.  Check your installation

To install libmagic in Macports, use:

port install file