python

Setting up Your M4 Mini for AI and ML - Part 1

Setting up your M4 Mini for AI and ML development with Miniconda, IDEs, JupyterLab and more.

Setting up Your M4 Mini for AI and ML - Part 1#

1. Installing Miniconda#

  • Download Miniconda for macOS (Apple Silicon) from the official website: https://docs.conda.io/en/latest/miniconda.html
  • Run the installer using the following command:
    bash Miniconda3-latest-MacOSX-arm64.sh
  • Add Conda to PATH:
    source ~/.zshrc  # If using zsh (default shell in macOS)
  • Verify the installation:
    conda --version

2. Installing IDEs: VSCode / PyCharm Community#

VSCode:#

  • Download and install from https://code.visualstudio.com/
  • Install using Homebrew:
    brew install --cask visual-studio-code
  • Download and Install VsCode Python extension:
    # Alternatively, you can install the extension using the command line:
    code --install-extension ms-python.python

PyCharm Community:#

Cursor(Optional):#

3. Updating Git#

  • Check if Git is installed:
    git --version
  • If not installed, install it via Homebrew:
    brew install git

4. Creating an AI Environment with Conda#

  • Create a new conda environment:
    conda create --name ai python=3.12
  • Activate the environment:
    conda activate ai

5. Installing JupyterLab#

  • Install JupyterLab in the conda environment:
    conda install -c conda-forge jupyterlab
  • Run JupyterLab:
    jupyter lab

Example dataset for testing:

curl -o iris.csv https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv
  • Load the dataset in JupyterLab:
import pandas as pd
df = pd.read_csv('iris.csv', header=None)
df.head()

6. Installing Python Dependency Management Tools#

Poetry:#

  • Install Poetry:
    curl -sSL https://install.python-poetry.org | python3 -
  • Configure Poetry:
    poetry config virtualenvs.in-project true

UV:#

  • Install UV:
    curl -LsSf https://astral.sh/uv/install.sh | sh

7. Running an Example Project - Build A Chatbot using Github Models#

Next Steps#

  • Explore more AI/ML libraries like TensorFlow, PyTorch, and Scikit-Learn.
  • Set up Docker and containerized environments for better reproducibility.