diff --git a/setup.py b/setup.py
index 459dc01e149a193f1d1dee7ee04b1857f304877a..0d3977c53b6a1ed84ef68bf1c025d26f0c783214 100644
--- a/setup.py
+++ b/setup.py
@@ -62,8 +62,11 @@ class doc(Command):
         if op.exists(destdir):
             shutil.rmtree(destdir)
 
-        env   = dict(os.environ)
-        ppath = [op.join(pkgutil.get_loader('fsl').filename, '..')]
+        env     = dict(os.environ)
+        dirname = pkgutil.get_loader('fsl').get_filename()
+        dirname = op.dirname(dirname)
+        dirname = op.abspath(op.join(dirname, '..'))
+        ppath   = [dirname]
 
         env['PYTHONPATH'] = op.pathsep.join(ppath)