--- a/setup.py
+++ b/setup.py
@@ -84,7 +84,8 @@
 
     def init_siteconfig(self):
         config = open("prewikka/siteconfig.py", "w")
-        config.write("tmp_dir = '%s'\n" % (os.path.join(tempfile.gettempdir(), "prewikka")))
+        config.write("import os, tempfile\n")
+        config.write("tmp_dir = os.path.join(tempfile.gettempdir(), 'prewikka')\n")
         config.write("conf_dir = '%s'\n" % (os.path.abspath(self.conf_prefix)))
         config.write("data_dir = '%s'\n" % (os.path.abspath(self.data_prefix)))
         config.write("libprelude_required_version = '%s'\n" % (LIBPRELUDE_REQUIRED_VERSION))
