问题
I just installed Haskell from it's official site. After that, following it's quick-start tutorial.
I run:
cabal update
Which shows this message:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
I run:
cabal install cabal-install
and check if the update was successful with
cabal update
The result, it shows me the same message from the start:
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
So, did I upgrade the cabal-install or not? How do I check my cabal's version?
Important: I'm using the 64 bits version for Mac OS X.
回答1:
I had a similar issue after installing the Haskell platform 2012.4.0.0
on OSX. When I ran cabal install cabal-install
, it ended with:
cabal: ../ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal: does not exist
So I guessed it got its paths mixed up somewhere. However the executable was actually built successfully (check for ~/Library/Haskell/ghc-7.4.2/lib/cabal-install-1.16.0.2/bin/cabal
) and I just copied it from there to ~/Library/Haskell/bin
which is on my path.
Thereafter everything ran OK:
$ which cabal
/Users/luke/Library/Haskell/bin/cabal
$ cabal update
Downloading the latest package list from hackage.haskell.org
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0.3 of the Cabal library
回答2:
In my case (and probably others?) cabal is initially installed in /usr/local/bin
by homebrew when installing haskell-platform
. When upgrading cabal, the version is installed to $HOME/.cabal/bin/cabal
. You ought to place your cabal bins higher in your $PATH
, like so:
export PATH=$HOME/.cabal/bin:$PATH
回答3:
Everyone seems to experience a slightly different issue here. In my case, cabal
was built successfully and installed to ~/Library/Haskell/bin
.
As noted in ~/.cabal/config
, adding ~/Library/Haskell/bin
to PATH
solved the issue.
Below is the description in ~/.cabal/config
:
-- === Built executables will be installed in:
-- ~/Library/Haskell/bin
--
-- You may wish to place this on your PATH by adding the following
-- line to your ~/.bash_profile:
-- export PATH="$HOME/Library/Haskell/bin:$PATH"
回答4:
On OS X 10.8 I had to add /Library/Haskell/bin
to my PATH (put it before /usr/bin
). Adding that fixed the error message
回答5:
cabal --version
gives you the version of cabal you're running. If you want to see the version of cabal-install you have, run cabal info cabal-install
and look at the versions installed line.
For me on OS X, versions installed is [unknown]
, after running cabal install cabal-install
, which is not great.
回答6:
I had this problem too.
After running which cabal
, I found that it was using /usr/bin/cabal
. Deleting this solved the problem.
回答7:
It seems that cabal by default installs packages locally for the current user and therefore will not be part of the PATH. Look at the Cabal documentation specifically step 1.2.1 where you can change the configuration to install things globally by default (not recommended).
The way I installed cabal was cabal --global install cabal-install
but still had problems with the path which since the default installation of Haskell puts the path in this order C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin;C:\Program Files\Haskell Platform\2013.2.0.0\bin;
where the first path has precedence over the second one. With the --global flag cabal installed the binary to C:\Program Files\Haskell\bin
which isn't in my path but must be added before the C:\Program Files\Haskell Platform\2013.2.0.0\lib\extralibs\bin
path.
Taken from the documentation
You must put the cabal.exe in a directory that is on your %PATH%, for example C:\Program Files\Haskell\bin.
回答8:
In my case, a combination of several answers here was required to get through this issue. I'll attempt to provide a more comprehensive solution in one answer for anyone else in my situation.
- For starters, running
which cabal
showed me that/usr/bin/cabal
was being loaded, which was a symlink to/Library/Haskell/ghc-7.8.3-x86_64/bin/cabal
. I believe newer versions of cabal were being installed, but this path was specific to a single version so they were ignored. Adding/Library/Haskell/bin
to the front of my$PATH
remedied that situation. - Second, and more importantly, the new versions of
cabal-install
were being installed into my cabal sandbox instead of the system location. I didn't see any other answers suggesting this, but after a little monkeying around I found that moving outside of my application's directory allowed cabal to actually install to the system. - Finally, adding the
--global
flag to the command fixed the problem. My final command wascabal install --global cabal-install
. After this, I was finally able to update properly.
TL;DR: if you use cabal sandboxes, move outside the directory of your project and run cabal install --global cabal-install
. Also, check your $PATH
variable as others have suggested.
回答9:
In my case the new version of cabal was being installed in the .cabal-sandbox of the project I was in.
e.g. Checking the version:
./.cabal-sandbox/bin/cabal --version
So I needed to upgrade it outside of that. This was on OSX.
来源:https://stackoverflow.com/questions/14918251/have-i-upgraded-my-cabal-install