Stack: How to install stack

Created on 22 Jan 2019  路  19Comments  路  Source: commercialhaskell/stack

Stack version

current

Method of installation

curl -sSL https://get.haskellstack.org/ | sh

but this fails

Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.rpm.lock'
You need to be root to perform this command.
Installing yum packages failed.  Please run 'yum check-update' and try again.

I don't have root on this machine. How can I install Haskell without root access?

upstream issue

All 19 comments

Try the following

curl -sSL https://get.haskellstack.org/ > stack.sh

Then edit stack.sh to change DEFAULT_DEST to a directory you have read, write and exec permissions. After that, you should be able to run ./stack.sh to install Stack provided all the dependencies are already installed. If they are not, you are out of luck and should ask an administrator of that machine to install stack or its dependencies for you.

I followed your instructions and modified the ./stack.sh script

@@ -21,7 +21,7 @@

 STACK_VERSION="1.9.3"
 HOME_LOCAL_BIN="$HOME/.local/bin"
-DEFAULT_DEST="/usr/local/bin/stack"
+DEFAULT_DEST="$HOME_LOCAL_BIN/stack"
 DEST=""
 QUIET=""
 FORCE=""

but I still get

Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.rpm.lock'
You need to be root to perform this command.
Installing yum packages failed.  Please run 'yum check-update' and try again.

@rwlock404 there exist a statically linked Stack version for X86_64. You could find it on https://github.com/commercialhaskell/stack/releases Could you try out using it? Just download and extract it somewhere on your $PATH (e.g. ~/.local/bin if it's a part of $PATH)

@rwlock404 Yes, you still need root access for the dependencies. Please try the statically linked version that @qrilka mentioned, if that doesn't work then you'll have to get an admin of that workstation to install at least the dependencies for you

Ok. I've talked to the admins and they want me to give them a list of packages I need installed. Where can I find such a list?

You can tell them to install stack directly, giving them the link to the instructions.

Or, you can check the script, depending on your OS you might want to look under do_fedora_install or do_centos_install or etc. Without any more information, the most conservative list would be

  • perl
  • make
  • automake
  • gcc
  • gmp-devel
  • libffi
  • zlib-devel
  • xz
  • tar
  • git
  • gnupg

(probably the last 3 not really needed, but better be sure)

Thanks! They insist on only installing things provided by the Linux distribution vendor into system-wide folders. I passed on the list and all but gmp-devel was already installed.

I re-ran the ./stack.sh script and I still get

Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.rpm.lock'
You need to be root to perform this command.
Installing yum packages failed.  Please run 'yum check-update' and try again.

I double checked and all the packages you listed show up as installed.

Comment the do_os line at the end of the script and try running it again. Now it should not try to do any install at all.

Sorry, replace do_os with install_64bit_standard_binary (or 32bit if you are on a 32 bits system)

Progress!

The project I need to work on needs resolver: lts-12.16 but stack build fails with

Downloaded lts-12.19 build plan.    
No setup information found for ghc-8.4.4 on your platform.
This probably means a GHC bindist has not yet been added for OS key 'linux64-gmp4'.
Supported versions: ghc-7.8.4, ghc-7.10.2, ghc-7.10.3, ghc-8.0.1, ghc-8.0.2, ghc-8.2.1, ghc-8.2.2, ghc-8.4.2

I tried with lts-12.0 hoping it would use ghc-8.4.2 but still no luck. I also tried lts-13.4 which failed with the same error. How come that Stack can't install any LTS for either ghc 8.4 nor ghc 8.6? Is there an ETA for when these will become available?

There are already LTSes for those

LTS 13.4 for GHC 8.6.3, published 4 days ago
LTS 12.26 for GHC 8.4.4, published 4 weeks ago
LTS 12.14 for GHC 8.4.3, published 3 months ago

Do you have system-ghc set somewhere?

You can try stack config set system-ghc --global true and then try building again?

I'm not aware of any prior system-ghc setting. I tried your stack config operation, but the error message saying that the GHC I need for lts-12.16 is not supported is still occuring.

Can you try the following set of commands? They are not related to your project, but just checks

$ cd
$ mkdir test
$ cd test
$ stack ghci

Let me know what the output of that is and then we'll go from there

It looks like #4161 is related and bindists for that platform are really missing from https://github.com/commercialhaskell/stackage-content/blob/master/stack/stack-setup-2.yaml#L415
I think going with the statically linked Stack should be more promising

The only command which had output was stack ghci

No setup information found for ghc-8.6.3 on your platform.
This probably means a GHC bindist has not yet been added for OS key 'linux64-gmp4'.
Supported versions: ghc-7.8.4, ghc-7.10.2, ghc-7.10.3, ghc-8.0.1, ghc-8.0.2, ghc-8.2.1, ghc-8.2.2, ghc-8.4.2

I think going with the statically linked Stack should be more promising

I downloaded and extracted https://github.com/commercialhaskell/stack/releases/download/v1.9.0.1/stack-1.9.0.1-linux-x86_64-static.tar.gz but it results in the same error message

No setup information found for ghc-8.6.3 on your platform.
This probably means a GHC bindist has not yet been added for OS key 'linux64-gmp4'.
Supported versions: ghc-7.8.4, ghc-7.10.2, ghc-7.10.3, ghc-8.0.1, ghc-8.0.2, ghc-8.2.1, ghc-8.2.2, ghc-8.4.2

Ok, let's go the statically linked way, seems something is missing from the other one.

When you extracted the tar.gz file, which files you got? Can you post the output of ls on the directory you extracted stuff to?

Now I see that my assumption was not quite well-founded - Stack linkage has nothing to do with availability of GHC for a particular platform. I'm not very familiar with CenOS (if it's the target distribution) but according to http://mirror.centos.org/centos/7/os/x86_64/Packages/ it looks like it has only ncurses-5.9 but the 6th version appears to be required for recent GHC versions.

For future reference: there are manual installation in instructions here for systems that the script doesn't support.

I'm guessing you're using CentOS 6. Unfortunately, recent versions of GHC are no longer releasing CentOS 6 compatible bindists (that link to libgmp4), so I'm afraid you're stuck with using older GHC versions if you want to have Stack manage the installation. In theory, it may be possible to build GHC from source code on your system (which Stack can then use if you pass in --system-ghc), but doing so is out of scope for Stack itself.

Since it is now a GHC (lack of availability) issue, I think we can now close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sjakobi picture sjakobi  路  3Comments

symbiont-joseph-kachmar picture symbiont-joseph-kachmar  路  3Comments

tinkyholloway picture tinkyholloway  路  4Comments

silky picture silky  路  3Comments

cybaj picture cybaj  路  3Comments