Plugin GUI: managing dependencies #3899
Replies: 2 comments 1 reply
-
yeah, this is the default behavior. packages bring along dependencies, but don't remove them when uninstalled, because other packages may also depend on them. There are third-party libraries like https://github.com/invl/pip-autoremove that will uninstall a package, and then additionally remove unused dependencies. But we don't currently use it. I'm not sure if something similar exists on the conda side (@jaimergp? @goanpeca?). In any case, while this sort of aggressive uninstallation might make sense in the bundled application, I feel like it's a bit risky to do by default. We're already walking on the edge of "proper etiquette" by offering a pip installer inside of the application that modifies the user's environment. We could conceivably add a checkbox (off by default) that says "uninstall along with all unused dependencies", but a) it's unclear how often that would really prevent the user from still needing to go to the command line to "unscrew-up" their environment... and b) if you failed to check it at first, and then wanted to go back and remove unused deps, I'm not sure how well that would work. environment management is tricky stuff for sure. this is definitely a strong argument in favor of the conda-based bundle @jaimergp and @goanpeca are working on, though I'll note for that dream to be fully realized, all plugin developers would need to get their package and all their binary dependencies building on conda. |
Beta Was this translation helpful? Give feedback.
-
It appears that one solution could be offered by using the build in console and the %pip or %conda: Edit: even better, with this trick I could tweak the features of napari-aicsimageio which requires installing sub-modules like readlif separately! Super cool! |
Beta Was this translation helpful? Give feedback.
-
I ran into an issue while testing the conda bundle and using just the GUI. Originally, I thought it was a bug, but it's a bit more complex and I think it's just how things are, so I thought i'd open this as a Discussion.
If a plugin is uninstalled via the Plugin GUI any dependencies that where installed along with it remain.
So if a plugin comes with a bum dependency—just a bad version/release/packaging issue—then there is no way to fix it by uninstall/reinstall, even if the dependency is fixed.
For example I installed napari-pyclesperanto-assistant, but it didn't run, because it happened that the latest release of pyopencl on pypi was bugged. I reported it to pyopencl and it was fixed—packaging issue—but still can't get the napari-pyclesperanto-assistant to work because the broken pyopencl remains installed.
Requirement already satisfied: pyopencl in /Users/piotrsobolewski/napari-0.4.13.dev224/lib/python3.9/site-packages (from napari-pyclesperanto-assistant) (2021.2.11)
In a normal, fresh conda env, I could fix this by installing an older version of pyopencl or (once it was fixed) reinstalling pyopencl, but these are more advanced things not exposed in the GUI.
To make matters worse, using the Plugin GUI to reinstall a plugin doesn't install updated dependencies, so if a user uninstalls the plugin (because it's broken by a depend), then even if a new version of a depend with a fix is released, a GUI user reinstalling the plugin will still not have it working, because the fixed depend won't be installed. I guess the plugin author would have to change the requirements to exclude the bum version.
I think this is all related to the default pip behavior?
Uninstalling all depends upon uninstall is likely tricky because different plugins may have overlapping depends. But perhaps there is some way to flag this and uninstall only unique depends, which are likely the issue.
Alternately, perhaps it is possible to enable the user to force a clean reinstall including depends? Again this can be an issue if another plugin depends on the same depends, but if it were wrapped in an "are you sure" message perhaps it would be ok?
Beta Was this translation helpful? Give feedback.
All reactions