-
Notifications
You must be signed in to change notification settings - Fork 841
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
Add stack uninstall
, the opposite of stack install
#361
Comments
stack uninstall
, the opposite of stack install
stack uninstall
, the opposite of stack install
Indeed. Ideas: There is the database entry (ghc-pkg unregister) and removing the data files and the installed executable. It should be possible to track what was installed where and then go remove that later, if it matches (e.g. does the thing here have the same sha1 hash and creation time as what we installed), that would permit removing from |
👍 I've needed this. |
Can someone explain what the motivation would be for using |
@snoyberg I've had difficulty reinstalling vendored/internal libraries in the past with Cabal and needed to unregister to get it to use the new version or get unstuck. It's possible this won't be an issue with Stack though. |
Say I install |
With #342, which I've been implementing, this would become a bit of a mess (how would you know which custom path to uninstall from?) stack uninstall XXX should also take a --path in this case, with ~/.local/bin (on Linux at least) being the default. Edit: what would be the expected result if I ran |
Aren't there two or three separate issues here: (1) deleting and unregistering library snapshots from the global stack database; (2) deleting and unregistering libraries from As @snoyberg says, if the package database works correctly the first two shouldn't ever be necessary except for space saving. (Right? Even if dependencies in the |
I'm quite tempted to close as wontfix. I haven't seen the use case clearly demonstrated that |
If we haven't already, we should print a helpful message if people call On Thursday, July 2, 2015, Michael Snoyman [email protected] wrote:
-- Dan Burton |
I would appreciate a
Usually at this point I start wondering if pandoc left around a settings file like I then wonder if pandoc left around some sort of man file like I guess I could do something like As an aside, when I'm installing a normal unix/linux package from source with |
This actually proves the point of why I don't think |
@snoyberg: I guess I'm guessing something like this would not be super simple to implement. It might not be worth it unless a lot of people want a |
Uninstalling the executables is trivial, since stack copies those itself. The rest of the files are not installed by stack at all. But I'm dubious about the value in uninstalling them anyway, since they (should) all be installed inside a snapshot-specific directory instead. Like I said, I've never felt the need for an uninstall command, so I may be the wrong person to make a call on this. But it doesn't seem like this is something people actually need, rather something people think they need. |
There's the perspective of newbie-friendliness. To remove an installed program, other languages have package managers with |
I just wanted to echo some comments above in support of this feature. My use case for wanting an uninstall command is two-fold:
As I look back at what I wrote, I think both use cases are similar enough that they could be summarized as follows: Libraries used during development might change, and uninstall would ideally make changing libraries a clean process without leaving behind artifacts or requiring the user to remember multiple invocations that don't have any obvious mnemonic . As another note, which perhaps isn't convincing, except perhaps on Mac OS X and a couple of fringe Linux distros, having to manually delete files to uninstall something feels wrong. I'm neither confident that I have uninstalled things properly, nor am I confident that in just deleting them (even if it is in my own home directory) that I haven't broken something else in the process. An official uninstall command would offer me some peace of mind. [*] I know, "stack is not a package manager". If it's existence is meant to improve the tooling situation for Haskell, I think perhaps it should be. |
I think it's important for a package manager to be able to remove packages it has installed in the project directory. Even if it can't cause build errors because the dependency version is explicitly specified in stack.yaml, it is confusing to have old versions hanging around. Unlike the global and the snapshot dbs, old files inside the local db cannot be used by any other project and are truly junk. At the very least, a "stack cleanup" command should be added which would remove all locally installed packages which are not being referred to by stack,yaml. |
It is clear that a lot of people are confusing what
Maybe So there are a few different behaviors here:
|
Splitting the up the issues, your list could be filled in as:
|
I meant to add that I'm not certain of the specifics of how a |
I thought about the option to add packages to a nix database, as a stack aware plugin. Uninstall could rollback the database to before the install, and that way it's not essential to keep track of dependencies or do a Every install would keep track of the files to be written to the database, as I believe As one possibility I had in mind |
@drwebb Can nix be used separately from nixOS? As in have a nix store for haskell things specifically, alongside the rest of the system? If so, are there any writeups or guides on this? Have you done it? I can't seem to find any. |
@vyp Nix can be used seperately from nixOS. The try-reflex project is using this approach to give users an easy way to try out reflex and ghcjs without having to install from source. The nix manual should (?) have all the information you need to get started using Nix. |
@cdepillabout Thanks. In that case I +1 to @drwebb's proposal. It could avoid a lot of work already handled much better with nix. I'm assuming this would mean that one would have to use nix (at least for haskell things), correct? If so, how difficult is it to write nix expressions for haskell packages. As in, it looks easy enough, but does anyone know of anyone who has any actually successfully done one? (For a large package.) Edit: Actually I take that back, it's pretty easy. |
I'm pretty excited about a 'cleanup'/'gc' command being added to stack! Bikeshedding here, but 'gc' doesn't seem to be a good name. Garbage collection usually doesn't have any observable effect on any semantics and is purely an implementation detail. I would vote for something more descriptive like 'autoremove' which is used in apt-get to perform exactly the same function i.e. remove packages which are not depended on by anything. Edit: Also, borrowing more cues from apt-get, on every 'stack build', it would be nice to ask the user to run 'autoremove' if there are orphan packages. |
I'm +1 on |
Or (also borrowing from git), |
|
On Tue, Jul 7, 2015, 10:39 Anupam Jain [email protected] wrote:
|
@snoyberg I was working with a vendored version of Yesod for testing a PR and I found a targeted (single package) |
@bitemyapp Tracked by #1476 |
But there's still no support for removing executables, which is what is easy for For the rest: yes, |
user-friendly package manager? :( |
Here is my use case.
I need to uninstall cryptohash because its presence is preventing me from being able to use cryptonite. |
I believe a workaround is |
It shouldn't break anything to use unregister, but if some project needs the package it will need to get rebuilt. I am working on a change that will make it so that |
I'm also confused that PackageImports are not working, isn't that another bug? Regardless, having support for uninstall seems still good to be able to workaround other bugs, since those exist. |
@mgsloan Yeah, it'd be fantastic if |
Yeah, it looks like there is a ghc bug here. Please file an upstream issue with ghc! Yeah, uninstall would be good. But I don't see a good way to do it without support for Cabal. Could maybe try to remove some things, but general uninstall seems impossible. @chris-martin I've fixed the behavior of |
Unregistering packages (recursively, which ghc-pkg unregister IIUC won't do) might be enough for some use cases. Yes, actually removing files is hard, maybe we should give up on that and do the rest (perfect is enemy of the good and so on). If disk usage becomes an actual problem we'll show the evidence to the Cabal devs (not that the needed changes on their side are easy). I remember I needed it to workaround different bugs (different scenario: ghc-paths had become invalid because Homebrew moved the system GHC). Again: different bugs were involved, but I maintain that alone is not a good argument. |
Ah, fair point! Well, if you're doing a stack build after the unregister, it will unregister + rebuild recursively. Indeed, though, it could leave some packages in the DB broken. So, yeah, it'd be worth automating recursive unregister, and probably wouldn't be too hard either! |
This is another gap in
cabal
thatstack
could fill. Ifstack install foo
installsfoo
, it would be nice to havestack uninstall foo
reverse the process.The text was updated successfully, but these errors were encountered: