Installing extras: cu.install
- colabutilscs4337.install(*targets, allow_changes=False, upgrade=False, dry=False, verbose=True, backend='auto')[source]
Install extras (
"cam","fastai","all") or any requirement strings.Every already-installed package is pinned to its current version, so this only ever adds packages. If that is impossible, nothing is installed and
InstallErrorexplains why.allow_changes=Truelifts the pins.dry=Truereports what would happen without installing.backend="auto"usesuvwhen it is installed (it is in Colab) andpipotherwise; if uv fails, pip is tried.upgrade=Trueupgrades only the requested packages, never their dependencies.Examples
>>> cu.install("cam") # Grad-CAM++ and friends >>> cu.install("torchmetrics", dry=True) # preview: what would be added? >>> cu.install("torchmetrics", upgrade=True) # newer torchmetrics only >>> cu.install("torchmetrics", backend="pip") # force pip
- Parameters:
targets (str)
allow_changes (bool)
upgrade (bool)
dry (bool)
verbose (bool)
backend (str)
- Return type:
- class colabutilscs4337._install.InstallResult(requested: 'list[str]', added: 'dict[str, str]', changed: 'dict[str, tuple[str, str]]', new_problems: 'list[str]', restart_needed: 'bool', backend: 'str' = 'pip')[source]
Bases:
object- Parameters:
requested (list[str])
added (dict[str, str])
changed (dict[str, tuple[str, str]])
new_problems (list[str])
restart_needed (bool)
backend (str)
- exception colabutilscs4337._install.UnresolvableError[source]
Bases:
InstallErrorThe request cannot be satisfied (with the current pins); retrying will not help.