Cabal update fails with 404 error trying to access a non existing file when compiling Apache Thrift - haskell

I'm trying to install Apache Thrift on my system, which performs a cabal update command. This command fails with the following message:
Downloading the latest package list from stackage cabal: Failed to download
http://www.stackage.org/stackage/7ae494fec2db3161dfb8e64677149285857478e0/00-index.tar.gz
: ErrorMisc "Error HTTP code: 404"
I normally use stack and I never had to do a cabal update manually. I don't know if the interaction between cabal and stack is a problem here.
Any ideas on how to fix this?
EDIT: Looking at my `~/.cabal/config~ I see the following entry:
remote-repo: stackage:http://www.stackage.org/stackage/7ae494fec2db3161dfb8e64677149285857478e0
So it seems that line is the culprit, but I don't know whether stack could have changed this for a good reason.

Related

stack install error: Recommended extra-dep

I am currently trying to install stack to utilise the software Taiji. I have been able to run 'stack setup', but get an error when I run stack install:
C:\Users\My Name\Taiji-1.2.1>stack install
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for shelly-1.8.1:
unix needed, but the stack configuration has no specified version (latest matching version is 2.7.2.2)
needed due to Taiji-1.2.1 -> shelly-1.8.1
Some different approaches to resolving this:
* Recommended action: try adding the following to your extra-deps in C:\Users\My Name\Taiji-1.2.1\stack.yaml:
- unix-2.7.2.2#sha256:9e93f93cc5a065248120136e83a0a6d1ce93d6eb5ef2a2543f9593e93e164d24,3496
Plan construction failed.
I am guessing I'll have to install another package of some sort and put it into the Taiji-1.2.1 folder, but am not exactly sure how(I am completely new to stack/programming). Is anyone able to help me with this issue? Thanks kindly.
When you see this error, you will need to open stack.yaml (the error message contains the full path), find the line saying # extra-deps: [], and replace it with the line shown in the error message:
extra-deps:
- unix-2.7.2.2#sha256:9e93f93cc5a065248120136e83a0a6d1ce93d6eb5ef2a2543f9593e93e164d24,3496
(If you already have something listed in extra-deps, then you can just add that line to the end of extra-deps rather than replacing the whole thing.)
Now, this is usually enough. But you’ve got a further problem: you are using Windows, but you’re trying to compile a program which depends on the unix package — a package which is not available on Windows. Due to this, you will not be able to compile your program on Windows.
(As for why all that extra-deps stuff is needed: basically, Stack maintains a list of package versions known to work with each other, but occasionally you will run into a package which isn’t in that list. In that case you will need to list that package version in extra-deps to tell Stack which version to use.)

Installing a package with cabal doesn't work (random)

I'm using Windows 10. I downloaded Cabal.exe, put it in my ghc-8.8.1\bin\ directory and ran it with command cabal update. It did nothing for a while, then it ended without any messages.
Now when I run cabal install random (trying to install package "random"), I get the following error:
cabal: Error: Could not find module: System.Random with any suffix:
["gc","chs","hsc","x","y","ly","cpphs","hs","lhs","hsig","lhsig"]. If the
module is autogenerated it should be added to 'autogen-modules'.
I have no clue why it does this.
I also tried installing the package manually (following the steps from here) - downloaded package random-1.1.tar.gz and ran:
cd filepathtopackage
c:\Program Files\Apps\ghc-8.8.1\bin\runhaskell.exe Setup configure
This for a change gives me the following error:
| C:\Program Files\Apps\ghc-8.8.1\lib\Cabal-3.0.0.0\HSCabal-3.0.0.0.o: unknown symbol '.file'
Setup: Setup: unable to load package 'Cabal-3.0.0.0'
When I run ghc-pkg list, Cabal is in there, so again, no clue why it does this.
Does anyone have any tips on how to resolve this?

IntelliJ Haskell plugin: ghc-modi failed with error

I just installed IntelliJ idea and the official Haskell plugin.
IntelliJ couldn't find ghc-modi.exe, so I installed ghc-mod through cabal.
However, after importing my cabal project, I am still receiving the following error:
ghc-modi failed with error: NG BUG: GMECabalFlags (GMEString "extractField: failed extracting configFlags from input, input contained `configFlags'? False")
How can I solve or get more information on this error?
Thanks in advance.
This question has been answered by Atsky on GitHub:
This is internal problem of ghc-mod. It fails to read file dist/setup-config for some reason.
Try to remove dist folder from your project and then run cabal config.

install yesod with stackage failed

environment:
ubuntu14.04
haskell platform 2014 2.0.0 (ghc 7.8.3,cabal 1.18.13)
stackage:Stackage build for GHC 7.8 + Haskell Platform, 2014-09-24, exclusive
according to http://www.yesodweb.com/page/quickstart , I ran:
dsu#dsu-G41MT-D3:~$ cabal install alex happy yesod-bin
Resolving dependencies...
Configuring ansi-terminal-0.6.1.1...
Configuring alex-3.1.3...
Downloading unix-time-0.3.4...
Failed to install ansi-terminal-0.6.1.1
Last 10 lines of the build log ( /home/dsu/.cabal/logs/ansi-terminal-0.6.1.1.log ):
Configuring asn1-types-0.2.3...
Configuring auto-update-0.1.1.3...
Failed to install alex-3.1.3
Last 10 lines of the build log ( /home/dsu/.cabal/logs/alex-3.1.3.log ):
Failed to install asn1-types-0.2.3
Configuring base-unicode-symbols-0.2.2.4...
Last 10 lines of the build log ( /home/dsu/.cabal/logs/asn1-types-0.2.3.log ):
Failed to install auto-update-0.1.1.3
Last 10 lines of the build log ( /home/dsu/.cabal/logs/auto-update-0.1.1.3.log ):
Configuring base64-bytestring-1.0.0.1...
Configuring blaze-builder-0.3.3.4...
Failed to install base-unicode-symbols-0.2.2.4
Last 10 lines of the build log ( /home/dsu/.cabal/logs/base-unicode-symbols-0.2.2.4.log ):
Failed to install unix-time-0.3.4
Last 10 lines of the build log ( /home/dsu/.cabal/logs/unix-time-0.3.4.log ):
cabal: /home/dsu/.cabal/logs/unix-time-0.3.4.log: does not exist
It simply says "fail to install" and give no any hints.Why use of stackage still has these problems?
This generic cabal debugging advice usually finds the problem....
Update the cabal database, try again
cabal update
cabal install ....
Try to install the dependency with the problem separately.... Looking above, it seems I see a few lines that start with "Failed to install....", test these separately.
cabal install base-unicode-symbols
Recurse if necessary.
Download the package that fails,
cabal unpack base-unicode-symbols
cd base-unicode-symbols-*
Configure to see if its dependencies are all loaded
cabal configure
If not, recurse into the troubled package.
Try to build the package
cabal build
If it doesn't work, you now have useful error messages. If you can fix the problem, great, else repost the information here.
Install
cabal install
In more drastic cases, you might want to delete (actually, just move it in case you want it back) your ~/.cabal/* contents, or your ~/.ghc/* contents, but leave this as a last resort, because you will have to reinstall all cabal packages. Also, you might want to keep the contents of ~/.cabal/bin/*.
I just updated Stackage Server to use FP Complete's Hackage mirror (which is Amazon S3 powered) instead of Hackage itself. That should make it completely resilient to Hackage downtime. Thanks for raising this issue, we definitely want Stackage to have better uptime guarantees than Hackage.
I've encountered the same problem. I have resolved it by temporarily deleting my HTTP_PROXY environment variable to not have cabal try to connect through an unreachable server.

How do I get Cabal to bypass my Windows proxy settings?

When retrieving packages with Cabal, I frequently get errors with this message:
user error (Codec.Compression.Zlib:
premature end of compressed stream)
It looks like Cabal is using my Windows Networking proxy settings (for Privoxy).
From digging around Google, Cabal or its libraries appear to have (had) a problem
in this area.
Possible solutions I can see are:
Turn off proxying while using Cabal (not very keen on this one); or
Get a patch and start hacking. I'm hesitant to go down this path,
as I'm a complete Haskell noob and I'm not yet comfortable with Darcs; or
Give it the magic "can I haz no proxy" parameter. Hence the question.
If I'm reading http://darcs.haskell.org/cabal-install/Distribution/Client/HttpUtils.hs correctly, you should be able to set the environment variable HTTP_PROXY to an invalid value (would "" work?) to get it to go direct.
Following #SamB's advice, and experimenting a bit, the solution I am now using is:
export HTTP_PROXY="::"
Here's part of the experimental log:
Try #SamB's solution:
[12:10:35z ~]:export HTTP_PROXY=""
[12:11:47z ~]:set|grep HTTP
HTTP_PROXY=
[12:11:50z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: connect: failed (Connection refused (WSAECONNREFUSED))
Try a "reasonable person's" solution:
[12:11:54z ~]:export HTTP_PROXY="None"
[12:12:02z ~]:set|grep HTTP
HTTP_PROXY=None
[12:12:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: user error [\]
(openTCPConnection: host lookup failure for "None")
Try an "unreasonable person's" solution:
[12:23:44z ~]:export HTTP_PROXY="::"
[12:24:00z ~]:set|grep HTTP
HTTP_PROXY=::
[12:24:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
Warning: invalid http proxy uri: "::"
Warning: proxy uri must be http with a hostname
Warning: ignoring http proxy, trying a direct connection
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
[12:24:34z ~]:
Yay!

Resources