How to reset Haskell package cache

Having decided to learn Haskell, he installed ghc on OS X via Homebrew (web binaries did not load at that time).

Everything is fine, following along with Learn You the Haskell , but then I decided to install some packages and see how everything works.

cabal install clckwrks-cli worked fine while ...

A public Internet track halfway through the installation / assembly of several projects.

Now none of these programs will be reinstalled, and in the case of clckwrks-cli I get the following error:

 $ cabal install clckwrks-cli --reinstall --force-reinstalls Resolving dependencies... Failed to install cipher-aes-0.2.6 Failed to install cipher-rc4-0.1.4 Failed to install cookie-0.4.0.1 Failed to install crypto-numbers-0.2.3 Configuring happstack-hsp-7.2.4... Building happstack-hsp-7.2.4... Preprocessing library happstack-hsp-7.2.4... ghc: could not execute: hsx2hs Failed to install happstack-hsp-7.2.4 Failed to install lifted-base-0.2.2.0 Failed to install publicsuffixlist-0.1 Failed to install pwstore-purehaskell-2.1.1 Configuring reform-hsp-0.2.4... Building reform-hsp-0.2.4... Preprocessing library reform-hsp-0.2.4... ghc: could not execute: hsx2hs Failed to install reform-hsp-0.2.4 Failed to install web-plugins-0.2.5 Failed to install wl-pprint-text-1.1.0.2 Failed to install xml-types-0.3.4 cabal: Error: some packages failed to install: attoparsec-conduit-1.0.1.2 depends on lifted-base-0.2.2.0 which failed to install. authenticate-1.3.2.6 depends on xml-types-0.3.4 which failed to install. blaze-builder-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to install. cipher-aes-0.2.6 failed while unpacking the package. The exception was: user error (data is not in tar format) cipher-rc4-0.1.4 failed while unpacking the package. The exception was: user error (data is not in tar format) clckwrks-0.21.1 depends on xml-types-0.3.4 which failed to install. clckwrks-cli-0.2.10 depends on xml-types-0.3.4 which failed to install. conduit-1.0.14 depends on lifted-base-0.2.2.0 which failed to install. cookie-0.4.0.1 failed while unpacking the package. The exception was: user error (data is not in tar format) cprng-aes-0.5.2 depends on cipher-aes-0.2.6 which failed to install. crypto-numbers-0.2.3 failed while unpacking the package. The exception was: user error (data is not in tar format) crypto-pubkey-0.2.4 depends on crypto-numbers-0.2.3 which failed to install. fb-0.14.11 depends on publicsuffixlist-0.1 which failed to install. happstack-authenticate-0.10.10 depends on xml-types-0.3.4 which failed to install. happstack-hsp-7.2.4 failed during the building phase. The exception was: ExitFailure 1 hsx-jmacro-7.3.4 depends on wl-pprint-text-1.1.0.2 which failed to install. http-conduit-1.9.6 depends on publicsuffixlist-0.1 which failed to install. jmacro-0.6.8 depends on wl-pprint-text-1.1.0.2 which failed to install. lifted-base-0.2.2.0 failed while unpacking the package. The exception was: user error (data is not in tar format) monad-logger-0.3.4.0 depends on lifted-base-0.2.2.0 which failed to install. publicsuffixlist-0.1 failed while unpacking the package. The exception was: user error (data is not in tar format) pwstore-purehaskell-2.1.1 failed while unpacking the package. The exception was: user error (data is not in tar format) reform-hsp-0.2.4 failed during the building phase. The exception was: ExitFailure 1 resourcet-0.4.10 depends on lifted-base-0.2.2.0 which failed to install. tls-1.1.5 depends on crypto-numbers-0.2.3 which failed to install. tls-extra-0.6.6 depends on crypto-numbers-0.2.3 which failed to install. web-plugins-0.2.5 failed while unpacking the package. The exception was: user error (data is not in tar format) wl-pprint-text-1.1.0.2 failed while unpacking the package. The exception was: user error (data is not in tar format) xml-conduit-1.1.0.9 depends on xml-types-0.3.4 which failed to install. xml-types-0.3.4 failed while unpacking the package. The exception was: user error (data is not in tar format) zlib-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to install. 

The same problem with several other projects that suffered during a network outage in the middle of the installation.

Loving the language so far, NOT package management :(

+6
source share
3 answers

Cabal sandboxes are often recommended for development, but work well for quickly checking out some packages. If something goes wrong, they are easily accessible and do not affect any other packages that you have already installed. Here is what I would do to try clckwrks-cli (BTW, if you just want to try any package, you can choose another package with less dependencies).

 $ cd /path/to/sandboxes $ cabal get clckwrks-cli $ cd clckwrks-cli-<version> $ cabal sandbox init $ cabal install --only-dependencies -j<N> # N is the number of CPU cores 

At this point, you can enter cabal run to run the executable installed by the package (which will probably be located in ./dist/build/bin/ ), cabal test to run tests, or cabal repl to run ghci with available sandbox packages.

If something goes wrong, you can return the sandbox by typing cabal sandbox delete and cabal clean . When you are done, you can safely remove the sandbox without compromising other packages.

+3
source

Here's what worked for me in the past For package $ f, do

 ghc-pkg.exe unregister --global --force $f ghc-pkg.exe recache 

According to its documentation, ghc-pkg.exe unregister "unregisters the package" and recache "regenerates the package database cache." --global must be used if the corresponding package was installed in the system directories.

If the database is badly damaged, I will delete the user directory or system folder and reinstall the packages that I had. I usually do this with cabal install one or more application libraries that I use and cabal reinstall dependencies. Note: cabal directory is OS and GHC version dependent.


ghc-pkg unregister --force clckwrks-cli

+1
source

I am having problems with unordered-containers-0.2.5.1 and deleting the file:

 ~/.cabal/packages/hackage.haskell.org/unordered-containers/0.2.5.1/unordered-containers-0.2.5.1.tar.gz 

fixed the problem for me. (i.e. cabal: data is not in tar format error cabal: data is not in tar format )

0
source

All Articles