As I started my journey into AI and Data Science, I quickly realized that managing Python environments can be a total headache. Between broken dependencies and 'it works on my machine' errors, I was spending more time troubleshooting my setup than actually writing code.
I wanted a way to streamline my workflow and keep my machine clean, so I moved to a Miniconda + Homebrew setup on my Mac. To save myself (and hopefully you) from digging through endless documentation, I condensed the 'essential' commands into a single, high-density A4 infographic.
This cheatsheet skips the legacy bloat and focuses on a production-first workflow:
Clean Installation: Setting up via Homebrew for macOS.
Environment Hygiene: Creating, cloning, and exporting environments so your projects stay isolated.
Jupyter Integration: Properly registering kernels so your notebooks actually see your installed packages.
The Workflow: A step-by-step checklist for starting any new project the right way.
Whether you are a fellow student trying to organize your labs or a developer looking for a 'no-nonsense' reference, I hope this helps you spend less time in the terminal and more time building."
🐍 Miniconda Cheatsheet
📦 Installation (macOS via Homebrew)
# Install Miniconda
brew install miniconda
# Init conda for zsh
conda init zsh
# Reload shell
source ~/.zshrc
# Verify
conda --version
🌍 Environment Management
# List all environments
conda env list
# Create a new environment
conda create --name myenv python=3.11
# Activate an environment
conda activate myenv
# Deactivate current environment
conda deactivate
# Delete an environment
conda env remove --name myenv
# Clone an environment
conda create --name newenv --clone myenv
# Export environment to file (for sharing/backup)
conda env export > environment.yml
# Recreate environment from file
conda env create -f environment.yml
# Show info about current environment
conda info
📚 Package Management
# Install a package
conda install numpy
# Install a specific version
conda install numpy=1.26
# Install multiple packages at once
conda install numpy pandas matplotlib scikit-learn
# Install from conda-forge channel (wider package selection)
conda install -c conda-forge jupyterlab
# Install with pip — ONLY when package is not available on conda or conda-forge
# Always check first: conda search -c conda-forge packagename
pip install somepackage
# Update a package
conda update numpy
# Update all packages in active environment
conda update --all
# Remove a package
conda remove numpy
# List installed packages in active environment
conda list
# Search for a package
conda search numpy
🚀 JupyterLab
# Install JupyterLab
conda install -c conda-forge jupyterlab
# Launch JupyterLab
jupyter-lab
# Launch from a specific folder
jupyter-lab --notebook-dir=~/projects
🔌 Kernel Management
# List available kernels
jupyter kernelspec list
# Register current env as a Jupyter kernel
conda install -c conda-forge ipykernel
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
# Remove a kernel
jupyter kernelspec remove myenv
🔧 Conda Maintenance
# Update conda itself
conda update conda
# Clean unused packages and cache (frees disk space)
conda clean --all
# Show conda configuration
conda config --show
# Add conda-forge as default channel
conda config --add channels conda-forge
conda config --set channel_priority strict
💡 Typical Project Workflow
# 1. Create and activate a fresh environment
conda create --name myproject python=3.11
conda activate myproject
# 2. Install packages (always prefer conda over pip inside conda envs)
conda install -c conda-forge jupyterlab numpy pandas matplotlib scikit-learn ipykernel
# 3. Register as a Jupyter kernel
python -m ipykernel install --user --name myproject --display-name "Python (myproject)"
# 4. Launch JupyterLab
jupyter-lab
# 5. When done, deactivate
conda deactivate
# 6. Export environment for reproducibility
conda env export > environment.yml
🗂️ Quick Reference
| Task | Command |
|---|---|
| Create env | conda create --name myenv python=3.11 |
| Activate env | conda activate myenv |
| Deactivate env | conda deactivate |
| Delete env | conda env remove --name myenv |
| Install package | conda install numpy |
| Remove package | conda remove numpy |
| List packages | conda list |
| List envs | conda env list |
| Launch JupyterLab | jupyter-lab |
| Export env | conda env export > environment.yml |
| Update conda | conda update conda |
| Clean cache | conda clean --all |

Top comments (0)