[Haskell-cafe] Installing Haskell on Windows 7

Duncan Coutts duncan.coutts at googlemail.com
Sun Dec 27 12:42:37 EST 2009

On Sun, 2009-12-27 at 10:06 +0100, Thomas Hühn wrote:

> The following packages are broken, either because they have a problem
> listed above, or because they depend on a broken package.
> binary-
> digest-
> template-
> utf8-string-0.3.6
> zip-archive-
> haddock-2.4.2
> Excuse me? Broken packages right after installation?

Except for haddock, none of these packages come with the Haskell
Platform. These are packages that you must have installed previously. So
ghc-pkg check is quite right to report them.

> Okay, reinstalling them all (with --user --reinstall").
> Except haddock:
> C:\Users\Thomas>cabal install haddock --user --reinstall
> Resolving dependencies...
> cabal: cannot configure haddock-2.6.0. It requires ghc >=6.12 && <6.14
> There is no available version of ghc that satisfies >=6.12 && <6.14

Right, try installing the same version as you've got currently rather
than the latest version.

In an ideal world the cabal-install package dependency resolver would
work out that the latest version cannot be installed (since it needs a
later ghc) and fall back to the next version that can work. However at
the moment it is not quite that smart. Use:

cabal install haddock-2.4.2

> "cabal install cabal-install" ends with:
> Linking dist\build\cabal\cabal.exe ...
> cabal: Error: some packages failed to install:
> cabal-install-0.6.4 failed during the final install step. The exception was:
> CreateDirectory: permission denied (Zugriff verweigert)
> Would be nice to know which directory cabal-install tried to create,
> don't you think?
> (This was just thrown in to show why I've only user user installations
> so far).
> Okay, the same with "--user" succeeds. Yay!

Right, global installs require admin permissions.

Historically Windows users did have admin permissions so the Windows
folks advised us that global should be the default. Obviously that's not
such a good default on Windows Vista or Windows 7. I've been agitating
to switch the default to per-user installations for a while now:


I've not got much feedback from the Windows Haskell hacker. In the
development version of cabal-install I'm going to experimentally switch
the default to per-user installs and see how that goes.

> Just for fun's sake, let's have a look into cabal's config file, since
> I seem to have some directory trouble:

> install-dirs global
>   -- prefix: "C:\\Program Files (x86)\\Haskell"
>   -- bindir: $prefix\bin
>   -- libdir: $prefix
>   -- libsubdir: $pkgid\$compiler
>   -- libexecdir: $prefix\$pkgid
>   -- datadir: "C:\\Program Files (x86)\\Haskell"
>   -- datasubdir: $pkgid
>   -- docdir: $prefix\doc\$pkgid
>   -- htmldir: $docdir\html
>   -- haddockdir: $htmldir
> I certainly don't have a "C:\\Program Files (x86)\\Haskell"
> folder.
> Might that result in problems?

No, but not having permissions to create it would.

You can edit this config file. I suggest you change it to use per-user
installs by default. Set "user-install: True" (and make sure you
uncomment the line, the "--" prefix).

> But then again I shouldn't have to meddle with some installed
> configuration file,

These defaults worked ok for Windows XP but they're clearly no good for
Vista and Win7. Just change the default to per-user installs.

> especially since there has been no warning that I had to do that and
> very especially since I entered my destination folder upon
> installation. Maybe it's okay, but it kind of makes me nervous. And
> God knows what else I haven't stumbled upon yet.

Where you install the Haskell Platform is independent of these settings.
You would not want to install other packages into the same location as
the platform and there's no particular reason to suppose that you would
have the file permissions to do so.

> Has anyone who is *not* a Haskell/ghc/cabal expert been able to
> install Haskell satisfactorily on Windows 7?

> What are my options now?  Any stupid mistakes I made?

No, it's reasonable to expect the defaults to work. Sadly they do not at
the moment for Windows 7. Change it to use per-user installs by default
and let us know how that goes.


More information about the Haskell-Cafe mailing list