ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
21.03k stars 1.4k forks source link

Should I use scoop to manage apps with package managers like anaconda, python pip, node npm, etc? #4075

Closed Xdminsy closed 2 years ago

Xdminsy commented 4 years ago

I'd like to use a package manager to manage my programming environments, but each language has its own package manager.

Say I found my anaconda can be updated, but it seems the old anaconda needs to be uninstalled and then the new one installs. But I already use conda/pip to install some packages like pytorch, PyQt5. And they should stay in the Lib directory and maybe add some script to Scripts, or make changes to other dirs, well I'm not sure.

So if it uninstalls and installs, is it means I need to reinstall pytorch or many other packages after the update? IIRC, I don't have such problems in traditional Linux pm like Arch's pacman when updating pip or ruby gem, I don't know how they update such pms.

So for these package managers, should more directories than only envs persist? Or should the updating processes have to change to retain the packages I installed, such as not to uninstall the old ones, just extract the new ones to replace the old files? Or just to hold it to disable updating?

brunovieira97 commented 4 years ago

AFAIK that's due to Scoop's nature of using portable apps. Many of those apps store everything (configs, packages, etc) inside their own directory, thus making them disappear if you run scoop uninstall \<app>.

Scoop has a persist feature, that allows a manifest to specify which directories should be kept between different versions of an app. If it's the case (e.g. simply keeping some directories unaltered will achieve what you need), you can simply open a PR adding these directories to the persist list of the manifest.

Otherwise, your options would be: 1) don't use Scoop for apps that manage other apps or packages (or that keep important libraries, see GCC fact at the end) on their directories 2) hold them so updating doesn't break managed apps/packages/libraries

I remember facing the same issue with GCC, when I stored all third-party library files inside scoop/apps/gcc/current, for the sake of faster and easier dependency detection and imports on C++. Updating GCC messed up my whole environment, and so I asked for the now implemented scoop hold command.

Xdminsy commented 4 years ago

Well in my view, such packages installed by pms(package managers) are unrelated to the version of pms. So I think it should be able to update the package manager while keeping the packages installed intact.

I found nodejs package persists the bin folder, and it seems the packages installed globally is in its node_modules, which means updating nodejs should need no reinstalling packages. But python have only global packages if not use venv, all the packages installed manually use the same folders as the packages shipped with python or anaconda, I think simply persisting some directories may not works well.

My workaround now is to scoop hold pms, and just let such pms to update themselves. Like pip install --upgrade pip. But if I want to update python, well I still have to reinstall packages 😢, the better way I think should be to optimize the update/uninstall process to not remove self-installed packages.

Luckz commented 3 years ago

I prefer using scoop only for tools that are not good at self-updating themselves. VS Code, or any browser, or Anaconda (I use Miniconda) are good at this anyway.

Node and Java are ecosystems where runtimes are installed side by side, so scoop is fitting to control the current one. I use nodejs-np from nonportable to avoid the issues you mention. While at it, for node pnpm is a much better experience than npm.

rashil2000 commented 2 years ago

The problem with python not persisting global packages was fixed recently.

Package managers that save global packages inside their installation directory should have the relevant directories persisted, just like nodejs and python do.

Boscop commented 1 year ago

@rashil2000 I just did scoop update python and it removed all my installed packages, I had pandas, matplotlib and many more. Any idea why it didn't persist those, and how I can prevent this from happening in the future?

> scoop update python
python: 3.8.1 -> 3.11.1
Updating one outdated app:
Updating 'python' (3.8.1 -> 3.11.1)
Downloading new version
Loading python-3.11.1-amd64.exe from cache
Checking hash of python-3.11.1-amd64.exe ... ok.
Uninstalling 'python' (3.8.1)
Running uninstaller script...
Removing shim 'python.shim'.
Removing shim 'python.exe'.
Removing shim 'python.ps1'.
Removing shim 'pythonw.shim'.
Removing shim 'pythonw.exe'.
Removing shim 'pythonw.ps1'.
Removing shim 'python3.shim'.
Removing shim 'python3.exe'.
Removing shim 'python3.ps1'.
Removing shim 'idle'.
Removing shim 'idle.cmd'.
Removing shim 'idle.ps1'.
Removing shim 'idle3'.
Removing shim 'idle3.cmd'.
Removing shim 'idle3.ps1'.
Unlinking ~\scoop\apps\python\current
Installing 'python' (3.11.1) [64bit] from main bucket
Loading python-3.11.1-amd64.exe from cache
Running pre_install script...
Running installer script...
Linking ~\scoop\apps\python\current => ~\scoop\apps\python\3.11.1
Creating shim for 'python3'.
Creating shim for 'idle'.
Creating shim for 'idle3'.
Persisting Scripts
Persisting Lib\site-packages
Running post_install script...

'python' (3.11.1) was installed successfully!
Notes
-----
Allow applications and third-party installers to find python by running:
"C:\Users\me\scoop\apps\python\current\install-pep-514.reg"

> pip list
Package    Version
---------- -------
pip        22.3.1
setuptools 65.5.0
rashil2000 commented 1 year ago

It shouldn't happen again. The issue was fixed after Python v3.9.7.