infoml.pkg
This module contains functions for managing - install, uninstall, check - python packages with both pip and conda.
Module Contents
Functions
|
Check if a package is installed. |
|
Install a python package with pip. |
|
Uninstall a python package with pip. |
- infoml.pkg.check_package(importname: str) bool[source]
Check if a package is installed.
- Parameters
importname (str) – Name used when importing the package
- Returns
True if package is installed, False otherwise
- Return type
bool
- infoml.pkg.pipinstall(packagename: str, importname: str = '', version: str = '', reinstall: bool = False) None[source]
Install a python package with pip.
Modified from the bmes package by Ahmet Sacan.
- Parameters
packagename (str, optional) – Name used for installing the package
importname (str) – Name used when importing the package, by default None In most cases, this is identical to packagename but both must be provided when they are different.
version (str, optional) – Version of the package to install, by default None
reinstall (bool, optional) – Should the package be reinstalled, by default False
Examples
>>> pipinstall('numpy'); >>> pipinstall('pandas', version='1.0.0'); >>> pipinstall('biopython', 'Bio')
- infoml.pkg.pipuninstall(packagename: str, importname: str = '') None[source]
Uninstall a python package with pip.
- Parameters
packagename (str) – Name used for installing the package
importname (str, optional) – Name used when importing the package, by default None In most cases, this is identical to packagename but both must be provided when they are different.
Examples
>>> pipuninstall('numpy');