Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get back to previous configuration. #464

Closed
dschalk opened this issue Jun 30, 2015 · 19 comments
Closed

Can't get back to previous configuration. #464

dschalk opened this issue Jun 30, 2015 · 19 comments

Comments

@dschalk
Copy link

dschalk commented Jun 30, 2015

I tried stack and couldn't make it work so I removed the .stack directory and everything stack in my application directory. I even brought back my latest Github update to make sure. When I enter 'cabal configure, I get this:
d@D:/websockets-react$ cabal configure
Resolving dependencies...
Configuring websockets-react-0.1.0.0...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package aeson-0.8.0.2 requires mtl-2.1.3.1
package websockets-0.9.5.0 requires mtl-2.2.1
package resourcet-1.1.5 requires mtl-2.2.1
package exceptions-0.8.0.2 requires mtl-2.2.1
package conduit-1.2.4.2 requires mtl-2.2.1
package conduit-extra-1.1.9 requires primitive-0.5.4.0
package vector-0.10.12.3 requires primitive-0.6
package primitive-0.6 requires transformers-0.3.0.0
package mtl-2.1.3.1 requires transformers-0.3.0.0
package wai-websockets-3.0.0.5 requires transformers-0.4.2.0
package wai-extra-3.0.7.1 requires transformers-0.4.2.0
package wai-app-static-3.1.0 requires transformers-0.4.2.0
package transformers-compat-0.4.0.4 requires transformers-0.4.2.0
package transformers-base-0.4.4 requires transformers-0.4.2.0
package streaming-commons-0.1.12.1 requires transformers-0.4.2.0
package resourcet-1.1.5 requires transformers-0.4.2.0
package optparse-applicative-0.11.0.2 requires transformers-0.4.2.0
package mtl-2.2.1 requires transformers-0.4.2.0
package monad-control-1.0.0.4 requires transformers-0.4.2.0
package mmorph-1.0.4 requires transformers-0.4.2.0
package exceptions-0.8.0.2 requires transformers-0.4.2.0
package cryptohash-conduit-0.1.1 requires transformers-0.4.2.0
package conduit-extra-1.1.9 requires transformers-0.4.2.0
package conduit-1.2.4.2 requires transformers-0.4.2.0
package websockets-react-0.1.0.0 requires transformers-0.4.3.0
d@D:
/websockets-react$
When I enter 'runghc Main', I get this:
Main.hs:15:18:
Could not find module ‘Network.Wai.Handler.WebSockets’
Use -v to see a list of the files searched for.

Main.hs:16:18:
Could not find module ‘Network.Wai.Application.Static’
Use -v to see a list of the files searched for.
d@D:/websockets-react$
When I then enter 'cabal install wai-websockets', I get:
Resolving dependencies...
All the requested packages are already installed:
wai-websockets-3.0.0.5
Use --reinstall if you want to reinstall anyway.
d@D:
/websockets-react$
Reinstalling doesn't help.
The command 'cabal build' causes my processor to go bananas until I can't stand it and enter 'CTR-c'.
My next stop will probably be to remove Cabal and reinstalling it, but don't see why that would work. By the way, I have been using Hackage. I ran cabal update during all of this and it seemed to install things rather than report that all is up to date.

@drwebb
Copy link
Contributor

drwebb commented Jun 30, 2015

Hi, let me see if I can help. First of all, stack and cabal can coexist, and stack doesn't overwrite anything of cabal's. So if you are experiencing a breakage, it would not be caused by removing ~/.stack or ./.stack-work.

It looks like you are facing the dreaded diamond dependency problem that is one of the reasons we created stack. I'm curious what problems you had with stack, perhaps we could diagnose that and get you going. Otherwise it's probably good idea to consider nuking your cabal package databases to fix your build problems. There are plenty of guides on the internet that can help you with that.

@dschalk
Copy link
Author

dschalk commented Jun 30, 2015

Update:
Wow. Your response was fast. I tried re-installing cabal-install and got:
bash-completion changelog ghc-pkg-stage2.list Setup tests
bootstrap.sh dist LICENSE Setup.hi
cabal-install.cabal Distribution Main.hs Setup.hs
cbits ghc-pkg.list README.md Setup.o
d@D:~/cabal-install-1.22.6.0$ ./bootstrap.sh
Using gcc for C compiler. If this is not what you want, set CC.
Using /usr/lib/gcc/x86_64-linux-gnu/4.8/collect2 instead.
Checking installed packages for ghc-7.8.4...
WARNING: there are broken packages. Run 'ghc-pkg check' for more details.
deepseq is already installed and the version is ok.
binary is already installed and the version is ok.
time is already installed and the version is ok.
Cabal is already installed and the version is ok.
transformers is already installed and the version is ok.
mtl is already installed and the version is ok.
text is already installed and the version is ok.
parsec is already installed and the version is ok.
network is already installed and the version is ok.
old-locale is already installed and the version is ok.
old-time is already installed and the version is ok.
HTTP is already installed and the version is ok.
zlib is already installed and the version is ok.
random is already installed and the version is ok.
stm is already installed and the version is ok.
WARNING: there are broken packages. Run 'ghc-pkg check' for more details.
network-uri is already installed and the version is ok.
cleaning...
[1 of 1] Compiling Main ( Setup.hs, Setup.o ) [Distribution.Simple changed]
Linking Setup ...
Configuring cabal-install-1.22.6.0...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package parsec-3.1.9 requires mtl-2.1.3.1
package HTTP-4000.2.19 requires mtl-2.1.3.1
package cabal-install-1.22.6.0 requires mtl-2.2.1
package mtl-2.1.3.1 requires transformers-0.3.0.0
package mtl-2.2.1 requires transformers-0.4.3.0
Building cabal-install-1.22.6.0...
Preprocessing executable 'cabal' for cabal-install-1.22.6.0...

Distribution/Client/BuildReports/Upload.hs:17:8:
Could not find module ‘Network.TCP’
There are files missing in the ‘HTTP-4000.2.19’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/Compat/Semaphore.hs:10:8:
Could not find module ‘Control.Concurrent.STM’
There are files missing in the ‘stm-2.4.4’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/Dependency/Modular/Validate.hs:10:8:
Could not find module ‘Control.Monad.Reader’
There are files missing in the ‘mtl-2.2.1’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/GZipUtils.hs:20:8:
Could not find module ‘Codec.Compression.GZip’
There are files missing in the ‘zlib-0.5.4.2’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/GZipUtils.hs:21:8:
Could not find module ‘Codec.Compression.Zlib.Internal’
There are files missing in the ‘zlib-0.5.4.2’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/HttpUtils.hs:13:8:
Could not find module ‘Network.HTTP’
There are files missing in the ‘HTTP-4000.2.19’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/HttpUtils.hs:16:8:
Could not find module ‘Network.HTTP.Proxy’
There are files missing in the ‘HTTP-4000.2.19’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/HttpUtils.hs:19:8:
Could not find module ‘Network.Browser’
There are files missing in the ‘HTTP-4000.2.19’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/HttpUtils.hs:22:8:
Could not find module ‘Network.Stream’
There are files missing in the ‘HTTP-4000.2.19’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/Types.hs:37:8:
Could not find module ‘Network.URI’
There are files missing in the ‘network-uri-2.6.0.1’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Distribution/Client/Upload.hs:31:8:
Could not find module ‘System.Random’
There are files missing in the ‘random-1.1’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.

Error during cabal-install bootstrap:
Building the cabal-install package failed.

Is this what you suggested I try, or did I misunderstand you. I'm inclined to reinstall GHC now. Do you know if version 7.10.1 is considered stable?

The problem with stack was the old 'cabal hell' problem of dependencies which couldn't be resolved.

@drwebb
Copy link
Contributor

drwebb commented Jun 30, 2015

This isn't really a forum for support on cabal install, but if you want to take it from the top we can try to get you running with stack. That would be:

  1. Download the Stack binary and put it in your $PATH
  2. Run stack setup
  3. Go to your project directory and run stack init and stack build
  4. Report any errors here by with the details of the command by running stack <command> --verbose and tell us your version with stack --version

Also, it looks like you are using a module from wai-app-static but you are trying to install wai-websockets.

@dschalk
Copy link
Author

dschalk commented Jun 30, 2015

I think the message said I needed both, so I didn't try wai-app-static after wai-websockets failed.

Maybe my troubles stem from installing stack from the Github repo. I am working in an Ubuntu-14.04 box. Where can I find an Ubuntu/Debian binary, or do I need to compile it?

@ketzacoatl
Copy link
Contributor

@dschalk Ubuntu install instructions can be found here: https://github.com/commercialhaskell/stack/wiki/Downloads#ubuntu

@dschalk
Copy link
Author

dschalk commented Jun 30, 2015

Thanks.

@dschalk
Copy link
Author

dschalk commented Jul 1, 2015

Back in cabal hell again. I'm using Stackage. I installed GHC-7.10.1 and reinstalled Cabal and cabal-install. Here's what I get:
d@D:/websockets-react$ cabal configure
Resolving dependencies...
Configuring server-0.2.0.0...
cabal: At least the following dependencies are missing:
wai-app-static -any, wai-websockets -any, websockets -any
d@D:
/websockets-react$ cabal install wai-app-static
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: wai-app-static-3.0.1.1 (user goal)
trying: cryptohash-conduit-0.1.1 (dependency of wai-app-static-3.0.1.1)
trying: conduit-extra-1.1.9 (dependency of cryptohash-conduit-0.1.1)
trying: streaming-commons-0.1.12.1/installed-464... (dependency of
conduit-extra-1.1.9)
trying: transformers-base-0.4.4 (dependency of conduit-extra-1.1.9)
trying: transformers-compat-0.4.0.3 (dependency of transformers-base-0.4.4)
trying: transformers-compat-0.4.0.3:-two
rejecting: transformers-compat-0.4.0.3:+three (conflict: streaming-commons =>
transformers==0.4.2.0/installed-c1a..., transformers-compat-0.4.0.3:three =>
transformers>=0.3 && <0.4)
rejecting: transformers-compat-0.4.0.3:-three (manual flag can only be changed
explicitly)
Dependency tree exhaustively searched.
d@D:~/websockets-react$
This situation arose when I tried to use stack, so it is worth noting here. I wish I could tell you exactly what I did. I thought I was following instructions.
I'm going to try stack again. Cabal doesn't work for me anymore.

@ketzacoatl
Copy link
Contributor

@dschalk, can you open a clone a clean checkout of your code to a new working directory, then follow @drwebb's instructions above? If you run into a problem with those instructions, please copy / paste the output from each command in that sequence with stack. Thank you!

@drwebb
Copy link
Contributor

drwebb commented Jul 1, 2015

@dschalk: You keep saying that you are using stack, but I haven't been able to verify you running a single stack command. As I said, this is not a cabal-install support forum. Could you give us the output of stack --version and stack build --verbose? Otherwise, I will have to close this as off topic.

@dschalk
Copy link
Author

dschalk commented Jul 1, 2015

Must I use GHC-7.8.4 in my project. I have 7.10.1. Anyway, here is what I have so far:
d@D:$ stack --version
Version 0.1.1.0, Git revision 2cac22d
d@D:
$ cd websockets-react
d@D:/websockets-react$ ls
client Logger2.hs score2.backup websockets-react.shabal
dist log.txt Setup.hs
Fm.hs Main.hs Setup.hs.save0
LICENSE README.md websockets-react.cabal
d@D:
/websockets-react$ ls dist
build package.conf.inplace setup-config
d@D:/websockets-react$ ls
client Logger2.hs score2.backup websockets-react.shabal
dist log.txt Setup.hs
Fm.hs Main.hs Setup.hs.save0
LICENSE README.md websockets-react.cabal
d@D:
/websockets-react$ rm *shabal
d@D:/websockets-react$ rm -R dist
d@D:
/websockets-react$ ls
client Logger2.hs README.md Setup.hs.save0
Fm.hs log.txt score2.backup websockets-react.cabal
LICENSE Main.hs Setup.hs
d@D:/websockets-react$ stack build
Unable to find a stack.yaml file in the current directory (/home/d/websockets-react/) or its ancestors
Recommended action: stack init
d@D:
/websockets-react$ stack init
Writing default config file to: /home/d/websockets-react/stack.yaml
Basing on cabal files:

  • /home/d/websockets-react/websockets-react.cabal

Downloaded lts-2.16 build plan.
Caching build plan
Fetched package index.
Populated index cache.
Checking against build plan lts-2.16
Selected resolver: lts-2.16
Wrote project config to: /home/d/websockets-react/stack.yaml
d@D:/websockets-react$ ls
client LICENSE log.txt README.md Setup.hs stack.yaml
Fm.hs Logger2.hs Main.hs score2.backup Setup.hs.save0 websockets-react.cabal
d@D:
/websockets-react$ runghc Main

Fm.hs:6:8:
Could not find module ‘Data.Aeson’
Perhaps you meant Data.Version (from base-4.8.0.0)
Use -v to see a list of the files searched for.

Main.hs:9:8:
Could not find module ‘Network.WebSockets.Connection’
Use -v to see a list of the files searched for.

Main.hs:12:18:
Could not find module ‘Network.WebSockets’
Perhaps you meant
Network.Socket (from network-2.6.2.0@netwo_Bdsn6Y1VKLa3MCczwSV70J)
Use -v to see a list of the files searched for.

Main.hs:15:18:
Could not find module ‘Network.Wai.Handler.WebSockets’
Perhaps you meant
Network.Wai.Handler.Warp.Date
Network.Wai.Handler.Warp.Recv
Network.Wai.Handler.Warp.Types
Use -v to see a list of the files searched for.

Main.hs:16:18:
Could not find module ‘Network.Wai.Application.Static’
Use -v to see a list of the files searched for.
d@D:/websockets-react$ stack install aeson
GHC version mismatched, found 7.10.1 (x86_64), but expected version 7.8.4 (x86_64) (based on resolver setting in /home/d/websockets-react/stack.yaml). Try running stack setup
d@D:
/websockets-react$ stack install websockets
GHC version mismatched, found 7.10.1 (x86_64), but expected version 7.8.4 (x86_64) (based on resolver setting in /home/d/websockets-react/stack.yaml). Try running stack setup
d@D:/websockets-react$ subl stack.yaml
d@D:
/websockets-react$ ls -a
. client .git Logger2.hs Main.hs score2.backup Setup.hs.save0 websockets-react.cabal
.. Fm.hs LICENSE log.txt README.md Setup.hs stack.yaml
d@D:/websockets-react$ stack install wai-websockets
GHC version mismatched, found 7.10.1 (x86_64), but expected version 7.8.4 (x86_64) (based on resolver setting in /home/d/websockets-react/stack.yaml). Try running stack setup
d@D:
/websockets-react$ stack setup
Preparing to download ghc-7.8.4 ...FailedConnectionException "www.haskell.org" 443
d@D:/websockets-react$ stack setup
Preparing to download ghc-7.8.4 ...FailedConnectionException "www.haskell.org" 443
d@D:
/websockets-react$

@dschalk
Copy link
Author

dschalk commented Jul 1, 2015

sudo stack setup still gave the 443 error message but after I entered sudo -i and returned to the project directory, stack setup worked.

@dschalk
Copy link
Author

dschalk commented Jul 1, 2015

OOps. In the end I got:
Caching build plan
Fetched package index.
Populated index cache.
Preparing to download ghc-7.8.4 ...FailedConnectionException "www.haskell.org" 443

@drwebb
Copy link
Contributor

drwebb commented Jul 1, 2015

It looks like you are on GHC 7.10 already, so try rm stack.yaml, and then stack init --prefer-nightly followed by a stack build

@dschalk
Copy link
Author

dschalk commented Jul 1, 2015

d@D:$ cabal install websockets
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: websockets (user goal)
rejecting: websockets-0.9.5.0 (global constraint requires ==0.9.3.1)
Dependency tree exhaustively searched.
d@D:
$ cabal list websockets

The Stackage version is 0.9.5.3. I suspect that stack somehow imposed the global constraint requiring ==0.9.3.1. What do you think?

@ketzacoatl
Copy link
Contributor

@dschalk, we aren't able to help in debugging issues with cabal, but you ought to be able to see success with:

rm stack.yaml
stack init --prefer-nightly
stack build

@radix
Copy link
Contributor

radix commented Jul 1, 2015

@dschalk You shouldn't be using sudo with stack, by the way. It does everything within your home directory.

(Makes me wonder if stack ought to error out if it detects it's running as root...)

@snoyberg
Copy link
Contributor

snoyberg commented Jul 1, 2015

I'm at an airport on my phone, so not the most amenable place for good comments. That said, I'm seeing three different things combined in this issue:

  • A lot of bug reports that belong on the cabal issue tracker. stack has nothing to do with any command that starts with cabal
  • Something funny going on with stack setup and downloading from haskell.org. It would be good to see if others are experiencing that as well. Could you email the mailing list and see if others are seeing something similar?
  • The fact that stack init chose a snapshot which isn't compatible with your already installed GHC. This isn't a bug; stack has to weigh different possible preferences from the user. Using the prefer-nightly flag should guide stack better for your needs

In general, when things get conflated, it's harder for people to assist. I'd recommend opening new, targeted issues as necessary and closing this one.

@radix The sudo thing may be worth pursuing, can you similarly open that up in a separate issue for discussion?

@radix
Copy link
Contributor

radix commented Jul 1, 2015

@snoyberg You got it: #471

@snoyberg
Copy link
Contributor

snoyberg commented Jul 2, 2015

The network issues are being tracked in #483. Better documentation for getting started with a cabal-oriented mindset are at #489. With those covered, I'm going to close this.

@snoyberg snoyberg closed this as completed Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants