Fix dependencies and add writable_dirs to setup.