Auto install and import ML/DL libraries in Python
Project description
installer-ml
A simple Python utility for auto-installing and importing common Data Science / Machine Learning libraries.
It helps you avoid ModuleNotFoundError by checking, installing (via pip), and importing automatically with aliases like np, pd, plt, sns, etc.
🚀 Features
- Auto-install missing packages using
pip. - Support for common ML/DL/NLP/CV libraries (scikit-learn, PyTorch, TensorFlow, XGBoost, LightGBM, Transformers, etc.).
- Automatic alias assignment (
np,pd,plt,sns,tf,torch, …). - Multiple installation modes:
- Silent (
quiet=True) → no logs at all. - Semi-silent (
quiet="semi") → minimal logs (default). - Verbose (
quiet=False) → full pip logs.
- Silent (
- Import one, many, or all libraries (
"*"). - Mapping
importname ↔ pip package name (e.g.,cv2 ↔ opencv-python,PIL ↔ pillow). - Display version after import.
📦 Installation
Clone or copy the file installer_ml.py into your project.
(If you later publish it to PyPI, you can install via pip install installer-ml).
🔑 Usage
1. Import a single library
from installer_ml import import_libs
import_libs("pandas")
print(pd.DataFrame({"a":[1,2,3]}))
2. Import multiple libraries
from installer_ml import import_libs
import_libs(["numpy", "pandas", "matplotlib"])
print(np.arange(5))
print(pd.DataFrame({"x":[1,2,3]}))
plt.plot([1,2,3], [2,4,6])
plt.show()
3. Import all supported libraries
from installer_ml import import_libs
import_libs("*")
4. Control logging
# Fully silent (no logs, no print)
import_libs(["numpy", "pandas"], True)
# Semi-silent (minimal messages, default)
import_libs(["numpy", "pandas"], "semi")
# Full logs
import_libs(["numpy", "pandas"], False)
📚 Supported Libraries & Aliases
| Library | Alias |
|---|---|
| numpy | np |
| pandas | pd |
| matplotlib (pyplot) | plt |
| seaborn | sns |
| scikit-learn | sklearn |
| xgboost | xgb |
| lightgbm | lgb |
| catboost | cb |
| torch | torch |
| torchvision | tv |
| torchaudio | ta |
| tensorflow | tf |
| keras | keras |
| transformers | trf |
| sentence-transformers | stf |
| spacy | spacy |
| nltk | nltk |
| gensim | gs |
| cv2 (OpenCV) | cv2 |
| pillow (PIL) | pil |
| imageio | imio |
| pyspark | spark |
| pyarrow | pa |
| tqdm | tqdm |
| joblib | joblib |
| h5py | h5 |
| scipy | sp |
| statsmodels | sm |
⚙️ Example with all aliases
from installer_ml import import_libs
import_libs("*")
print(np.arange(5))
print(pd.DataFrame({"x":[1,2,3]}))
plt.plot([1,2,3], [2,4,6])
plt.show()
print(tf.__version__) # tensorflow
print(torch.__version__) # pytorch
print(trf.__version__) # transformers
📌 License
MIT License. Free to use and modify.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file installer_ml-1.1.5.tar.gz.
File metadata
- Download URL: installer_ml-1.1.5.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
774fe55436c401216d88dcb46bff6456ced7da226c70f58153eeaba34f6ef676
|
|
| MD5 |
d657c1fa9b7b96fd790bd7297fe9326f
|
|
| BLAKE2b-256 |
220845454b8a37bb031814aec09096c9eea9c0657ffd372870efe68d69446c52
|
File details
Details for the file installer_ml-1.1.5-py3-none-any.whl.
File metadata
- Download URL: installer_ml-1.1.5-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5960a064700b10851c571df9c6d0a2eed5c6889ab75487870513b8003b102482
|
|
| MD5 |
2a0f09624e900f46fae5f3e94f649606
|
|
| BLAKE2b-256 |
c6bc2e3bbb0f31a019a351daf418f80b3224d8fc9f6812528695e48c04574a69
|