haskell / haskell-platform

Distribution of Haskell with batteries included
http://www.haskell.org/platform/
Other
380 stars 91 forks source link

Error: cabal install #329

Closed huangwb8 closed 5 years ago

huangwb8 commented 5 years ago

The strange error would appear if I try to install a package.

For example:

$ cabal install pandoc-citeproc
Resolving dependencies...
cabal: internal error when reading package index: failed to parse .cabal
fileThe package index or index cache is probably corrupt. Running cabal update
might fix it.

I had tried 'cabal update' but it seems not work.

Here are some systerm massage. Looking forward to your return!

$ cat /etc/issue
Ubuntu 18.04.3 LTS \n \l

$ $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/huangwb8/Downloads/sratoolkit/sratoolkit.2.9.6-ubuntu64/bin:/home/huangwb8/.aspera/connect/bin:/home/huangwb8/Downloads/conda/location/bin:/home/huangwb8/Downloads/conda/location:/home/huangwb8/Downloads/conda/location/envs/bioinf:/home/huangwb8/Downloads/conda/location/envs/bioinf/bin:/home/huangwb8/Downloads/conda/location/envs/python3:/home/huangwb8/Downloads/conda/location/envs/python3/bin:/home/huangwb8/.local/bin:/home/huangwb8/bin:/home/huangwb8/.cabal

$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library 

$ cat ~/.cabal/config
-- This is the configuration file for the 'cabal' command line tool.

-- The available configuration options are listed below.
-- Some of them have default values listed.

-- Lines (like this one) beginning with '--' are comments.
-- Be careful with spaces and indentation because they are
-- used to indicate layout for nested sections.

-- Cabal library version: 1.24.2.0
-- cabal-install version: 1.24.0.2

repository mirrors.tuna.tsinghua.edu.cn
 url: http://mirrors.tuna.tsinghua.edu.cn/hackage

-- default-user-config:
-- require-sandbox: False
-- ignore-sandbox: False
-- ignore-expiry: False
-- http-transport:
remote-repo-cache: /home/huangwb8/.cabal/packages
-- local-repo:
-- logs-dir:
world-file: /home/huangwb8/.cabal/world
-- verbose: 1
-- compiler: ghc
-- with-compiler:
-- with-hc-pkg:
-- program-prefix: 
-- program-suffix: 
-- library-vanilla: True
-- library-profiling:
-- shared:
-- executable-dynamic: False
-- profiling:
-- executable-profiling:
-- profiling-detail:
-- library-profiling-detail:
-- optimization: True
-- debug-info: False
-- library-for-ghci:
-- split-objs: False
-- executable-stripping: True
-- library-stripping: True
-- configure-option:
-- user-install: True
-- package-db:
-- flags:
-- extra-include-dirs:
-- extra-lib-dirs:
-- extra-framework-dirs:
extra-prog-path: /home/huangwb8/.cabal/bin
-- tests: False
-- coverage: False
-- library-coverage:
-- allow-newer: False
-- exact-configuration: False
-- benchmarks: False
-- relocatable: False
-- cabal-lib-version:
-- constraint:
-- preference:
-- solver: choose
-- documentation: False
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
-- max-backjumps: 2000
-- reorder-goals: False
-- shadow-installed-packages: False
-- strong-flags: False
-- reinstall: False
-- avoid-reinstalls: False
-- force-reinstalls: False
-- upgrade-dependencies: False
-- root-cmd:
-- symlink-bindir:
build-summary: /home/huangwb8/.cabal/logs/build.log
-- build-log:
remote-build-reporting: anonymous
-- report-planning-failure: False
-- one-shot: False
-- run-tests:
jobs: $ncpus
-- offline: False
-- username:
-- password:
-- password-command:
-- builddir:

haddock
  -- keep-temp-files: False
  -- hoogle: False
  -- html: False
  -- html-location:
  -- executables: False
  -- tests: False
  -- benchmarks: False
  -- all:
  -- internal: False
  -- css:
  -- hyperlink-source: False
  -- hscolour-css:
  -- contents-location:

install-dirs user
  -- prefix: /home/huangwb8/.cabal
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

install-dirs global
  -- prefix: /usr/local
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

program-locations
  -- alex-location:
  -- ar-location:
  -- c2hs-location:
  -- cpphs-location:
  -- gcc-location:
  -- ghc-location:
  -- ghc-pkg-location:
  -- ghcjs-location:
  -- ghcjs-pkg-location:
  -- greencard-location:
  -- haddock-location:
  -- happy-location:
  -- haskell-suite-location:
  -- haskell-suite-pkg-location:
  -- hmake-location:
  -- hpc-location:
  -- hsc2hs-location:
  -- hscolour-location:
  -- jhc-location:
  -- ld-location:
  -- lhc-location:
  -- lhc-pkg-location:
  -- pkg-config-location:
  -- strip-location:
  -- tar-location:
  -- uhc-location:

program-default-options
  -- alex-options:
  -- ar-options:
  -- c2hs-options:
  -- cpphs-options:
  -- gcc-options:
  -- ghc-options:
  -- ghc-pkg-options:
  -- ghcjs-options:
  -- ghcjs-pkg-options:
  -- greencard-options:
  -- haddock-options:
  -- happy-options:
  -- haskell-suite-options:
  -- haskell-suite-pkg-options:
  -- hmake-options:
  -- hpc-options:
  -- hsc2hs-options:
  -- hscolour-options:
  -- jhc-options:
  -- ld-options:
  -- lhc-options:
  -- lhc-pkg-options:
  -- pkg-config-options:
  -- strip-options:
  -- tar-options:
  -- uhc-options:
huangwb8 commented 5 years ago

I know the reason~ It's because I changed the default mirrors to the one of Tsinghua University.

repository mirrors.tuna.tsinghua.edu.cn
 url: http://mirrors.tuna.tsinghua.edu.cn/hackage

I was surprised that the problematical Tsinghua University mirror of haskell was widely recommand in China but nobody met the same problem like me. Maybe there are other setting needed but apparently the help doc of tsinghua mirror didn't provide other masseges. Whatever, it works well with default config even if I have to bear the slow speed.

gbaz commented 5 years ago

It could just be an unrecoverable corrupt download from the mirror. Clearing out the 01-index* the 00-index.* and the *.json from ~/.cabal/packages/mirrors.tuna.tsinghua.edu.cdn might fix it. (or even clearing out the whole directory.)