Install Haskell packages using cabal without internet connection
Asked Answered
A

2

6

I have a machine that doesn't have internet access at all.
I installed the Haskell Platform on it using the installer which I got from another machine through a pendrive.

Now I want to install the package repa on my home machine which has no internet access. How should I do that?

My home machine is running Linux (Debian) and my office machine is Windows 7.

Allot answered 15/2, 2015 at 4:7 Comment(0)
F
8

From a machine you can access the internet you can either:

  • Run cabal get pkg-name where pkg-name is the package you want.
  • Go to the package's page on Hackage and on the Downloads section there's a .tar.gz file you can download.

After you get it, transfer it to your other machine, extract it anywhere you'd like (a sandbox if you want it just in a sandbox). Then from that directory (where there's a .cabal file) run cabal install.

Faugh answered 15/2, 2015 at 4:44 Comment(2)
Is there a quick way to find the dependencies of the package and download those as well, or must this be done manually?Huonghupeh
@Huonghupeh Not that I know of, but writing a tool for that should be very easy since Cabal is also on Hackage. You could get the package (however you want; e.g. you could call cabal get using System.Process), then simply use the Cabal package to parse the cabal file, and then just recursively do the same for package dependencies.Faugh
R
1

Package managers, such as cabal, work internally to get a package from a remote repository. I doubt there exist an easy workaround to make cabal install a package in offline mode.

Probably the easiest way is to find a compressed version of package, find a way to get them on the offline computer (local sharing, thumb drive, etc.) and install a package manually.

Ragucci answered 15/2, 2015 at 4:30 Comment(1)
There is no terrible difficulty in getting Cabal to install a package offline as long as the package and all its dependencies are locally available.Administration

© 2022 - 2024 — McMap. All rights reserved.