Ensure essential packages are not detached! #402
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this branch, I removed the part detaching packages in
scib.pp.normalize
because it would lead to unpredictable errors when using rpy2 to run R code.After learning from my own experience, I want to advise against detaching R packages casually. Instead, after deleting
rm(list=ls())
, runninggc()
usually suffices.A simple example: in the final part of
scib.pp.normalize
, detaching most R packages, includingscran
and its dependency packageS4Vector
, would result in errors such as "cannot coerce class 'integer' to a DataFrame" if a loop code block is set up. Even if you reloadscran
(which depends onS4Vector
) orS4Vector
, the error persists and can only be resolved by restarting your kernel. Next, I'll demonstrate this issue with a simple example.example.md