Fix writing to karma file.

Write to a new file then copy.  Directly writing to the old file can corrupt
the content if the size changes.
Add directory dependency and loosen version constraints.
Change to standardized spaceapi.

http://spaceapi.net/